Conversation: savePromises for off-queue post-handleDataMessage work

This commit is contained in:
Scott Nonnenberg 2024-08-28 16:05:08 +10:00 committed by GitHub
parent 059c971ee2
commit 768ab26a20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 145 additions and 62 deletions

View file

@ -300,6 +300,8 @@ export class ConversationModel extends window.Backbone
private isShuttingDown = false;
private savePromises = new Set<Promise<void>>();
override defaults(): Partial<ConversationAttributesType> {
return {
unreadCount: 0,
@ -466,6 +468,16 @@ export class ConversationModel extends window.Backbone
}
}
addSavePromise(promise: Promise<void>): void {
this.savePromises.add(promise);
}
removeSavePromise(promise: Promise<void>): void {
this.savePromises.delete(promise);
}
getSavePromises(): Array<Promise<void>> {
return Array.from(this.savePromises);
}
toSenderKeyTarget(): SenderKeyTargetType {
return {
getGroupId: () => this.get('groupId'),