From 9645c210dd1083b7e9c34b2140f7ebd381e59a44 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 27 Jan 2021 18:05:04 +1100 Subject: [PATCH] skip updateLastMessage for inactive convos those are the ones created when getting messages on a public group. they are not shown on the conversation list --- js/models/conversations.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 8558b41a3..5389bad57 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -849,16 +849,18 @@ ); await serverAPI.setAvatar(url, profileKey); }, - async updateLastMessage() { + async bouncyUpdateLastMessage() { if (!this.id) { return; } - + if (!this.get('active_at')) { + window.log.info('Skipping update last message as active_at is falsy'); + return; + } const messages = await window.Signal.Data.getMessagesByConversation( this.id, { limit: 1, MessageCollection: Whisper.MessageCollection } ); - const lastMessageModel = messages.at(0); const lastMessageJSON = lastMessageModel ? lastMessageModel.toJSON() @@ -874,12 +876,10 @@ ? lastMessageModel.getNotificationText() : null, }); - // Because we're no longer using Backbone-integrated saves, we need to manually // clear the changed fields here so our hasChanged() check below is useful. this.changed = {}; this.set(lastMessageUpdate); - if (this.hasChanged()) { await this.commit(); }