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
This commit is contained in:
Audric Ackermann 2021-01-27 18:05:04 +11:00
parent 13df6c476e
commit 9645c210dd

View file

@ -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();
}