Timeline date headers
This commit is contained in:
parent
0fa069f260
commit
f9440bf594
41 changed files with 1183 additions and 771 deletions
|
@ -213,6 +213,9 @@ export class ConversationModel extends window.Backbone
|
|||
|
||||
private isInReduxBatch = false;
|
||||
|
||||
// This number is recorded as an optimization and may be out of date.
|
||||
private newestReceivedAtMarkedRead?: number;
|
||||
|
||||
override defaults(): Partial<ConversationAttributesType> {
|
||||
return {
|
||||
unreadCount: 0,
|
||||
|
@ -4572,6 +4575,15 @@ export class ConversationModel extends window.Backbone
|
|||
sendReadReceipts: true,
|
||||
}
|
||||
): Promise<void> {
|
||||
// This early return is an optimization, not a guarantee.
|
||||
const { newestReceivedAtMarkedRead } = this;
|
||||
if (
|
||||
typeof newestReceivedAtMarkedRead === 'number' &&
|
||||
newestUnreadAt <= newestReceivedAtMarkedRead
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
await markConversationRead(this.attributes, newestUnreadAt, options);
|
||||
|
||||
const unreadCount = await window.Signal.Data.getTotalUnreadForConversation(
|
||||
|
@ -4583,6 +4595,8 @@ export class ConversationModel extends window.Backbone
|
|||
this.set({ unreadCount });
|
||||
window.Signal.Data.updateConversation(this.attributes);
|
||||
}
|
||||
|
||||
this.newestReceivedAtMarkedRead = newestUnreadAt;
|
||||
}
|
||||
|
||||
// This is an expensive operation we use to populate the message request hero row. It
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue