Use read sync timestamp to do unread bookkeeping
This commit is contained in:
parent
ed92d244b2
commit
fc34cd88b8
3 changed files with 19 additions and 4 deletions
|
@ -19,6 +19,7 @@ import { SeenStatus } from '../MessageSeenStatus';
|
|||
import { SendActionType, sendStateReducer } from '../messages/MessageSendState';
|
||||
import { canConversationBeUnarchived } from './canConversationBeUnarchived';
|
||||
import { deleteForEveryone } from './deleteForEveryone';
|
||||
import { drop } from './drop';
|
||||
import { handleEditMessage } from './handleEditMessage';
|
||||
import { isGroup } from './whatTypeOfConversation';
|
||||
import { isStory, isTapToView } from '../state/selectors/message';
|
||||
|
@ -167,6 +168,7 @@ export async function modifyTargetMessage(
|
|||
if (!isFirstRun && message.getPendingMarkRead()) {
|
||||
const markReadAt = message.getPendingMarkRead();
|
||||
message.setPendingMarkRead(undefined);
|
||||
const newestSentAt = readSync?.timestamp;
|
||||
|
||||
// This is primarily to allow the conversation to mark all older
|
||||
// messages as read, as is done when we receive a read sync for
|
||||
|
@ -175,7 +177,11 @@ export async function modifyTargetMessage(
|
|||
// We run message when `isFirstRun` is false so that it triggers when the
|
||||
// message and the other ones accompanying it in the batch are fully in
|
||||
// the database.
|
||||
void message.getConversation()?.onReadMessage(message, markReadAt);
|
||||
drop(
|
||||
message
|
||||
.getConversation()
|
||||
?.onReadMessage(message, markReadAt, newestSentAt)
|
||||
);
|
||||
}
|
||||
|
||||
// Check for out-of-order view once open syncs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue