fix async issue

pull/1786/head
Brice-W 4 years ago
parent e5615357f7
commit 6bbabce8e3

@ -947,7 +947,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
// Build the list of updated message models so we can mark them all as read on a single sqlite call
for (const nowRead of oldUnreadNowRead) {
nowRead.markReadNoCommit(options.readAt);
await nowRead.markReadNoCommit(options.readAt);
const errors = nowRead.get('errors');
read.push({

@ -1045,20 +1045,20 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
}
public async markRead(readAt: number) {
this.markReadNoCommit(readAt);
await this.markReadNoCommit(readAt);
this.getConversation()?.markRead(this.attributes.received_at);
await this.commit();
}
public markReadNoCommit(readAt: number) {
public async markReadNoCommit(readAt: number) {
this.set({ unread: 0 });
if (this.get('expireTimer') && !this.get('expirationStartTimestamp')) {
const expirationStartTimestamp = Math.min(Date.now(), readAt || Date.now());
this.set({ expirationStartTimestamp });
this.setToExpire(false);
await this.setToExpire(false);
}
window.Whisper.Notifications.remove(

Loading…
Cancel
Save