New 'unseenStatus' field for certain secondary message types

This commit is contained in:
Scott Nonnenberg 2022-04-22 11:35:14 -07:00 committed by GitHub
parent ed9f54d7d6
commit 3a1df01c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 610 additions and 143 deletions

View file

@ -88,10 +88,10 @@ export type PropsDataType = {
messageLoadingState?: TimelineMessageLoadingState;
isNearBottom?: boolean;
items: ReadonlyArray<string>;
oldestUnreadIndex?: number;
oldestUnseenIndex?: number;
scrollToIndex?: number;
scrollToIndexCounter: number;
totalUnread: number;
totalUnseen: number;
};
type PropsHousekeepingType = {
@ -342,7 +342,7 @@ export class Timeline extends React.Component<
items,
loadNewestMessages,
messageLoadingState,
oldestUnreadIndex,
oldestUnseenIndex,
selectMessage,
} = this.props;
const { newestBottomVisibleMessageId } = this.state;
@ -358,15 +358,15 @@ export class Timeline extends React.Component<
if (
newestBottomVisibleMessageId &&
isNumber(oldestUnreadIndex) &&
isNumber(oldestUnseenIndex) &&
items.findIndex(item => item === newestBottomVisibleMessageId) <
oldestUnreadIndex
oldestUnseenIndex
) {
if (setFocus) {
const messageId = items[oldestUnreadIndex];
const messageId = items[oldestUnseenIndex];
selectMessage(messageId, id);
} else {
this.scrollToItemIndex(oldestUnreadIndex);
this.scrollToItemIndex(oldestUnseenIndex);
}
} else if (haveNewest) {
this.scrollToBottom(setFocus);
@ -790,7 +790,7 @@ export class Timeline extends React.Component<
isSomeoneTyping,
items,
messageLoadingState,
oldestUnreadIndex,
oldestUnseenIndex,
onBlock,
onBlockAndReportSpam,
onDelete,
@ -804,7 +804,7 @@ export class Timeline extends React.Component<
reviewMessageRequestNameCollision,
showContactModal,
theme,
totalUnread,
totalUnseen,
unblurAvatar,
unreadCount,
updateSharedGroups,
@ -898,17 +898,17 @@ export class Timeline extends React.Component<
}
let unreadIndicatorPlacement: undefined | UnreadIndicatorPlacement;
if (oldestUnreadIndex === itemIndex) {
if (oldestUnseenIndex === itemIndex) {
unreadIndicatorPlacement = UnreadIndicatorPlacement.JustAbove;
messageNodes.push(
<LastSeenIndicator
key="last seen indicator"
count={totalUnread}
count={totalUnseen}
i18n={i18n}
ref={this.lastSeenIndicatorRef}
/>
);
} else if (oldestUnreadIndex === nextItemIndex) {
} else if (oldestUnseenIndex === nextItemIndex) {
unreadIndicatorPlacement = UnreadIndicatorPlacement.JustBelow;
}