Bring lastMessage and lastMessageStatus back to conversation
This commit is contained in:
parent
dcd16775c3
commit
812f895e12
2 changed files with 11 additions and 20 deletions
|
@ -224,7 +224,13 @@
|
||||||
|
|
||||||
this._initialFetchComplete = true;
|
this._initialFetchComplete = true;
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
conversations.map(conversation => conversation.updateLastMessage())
|
conversations.map(conversation => {
|
||||||
|
if (!conversation.get('lastMessage')) {
|
||||||
|
return conversation.updateLastMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
})
|
||||||
);
|
);
|
||||||
window.log.info('ConversationController: done with initial fetch');
|
window.log.info('ConversationController: done with initial fetch');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -135,8 +135,6 @@
|
||||||
this.unset('unidentifiedDeliveryUnrestricted');
|
this.unset('unidentifiedDeliveryUnrestricted');
|
||||||
this.unset('hasFetchedProfile');
|
this.unset('hasFetchedProfile');
|
||||||
this.unset('tokens');
|
this.unset('tokens');
|
||||||
this.unset('lastMessage');
|
|
||||||
this.unset('lastMessageStatus');
|
|
||||||
|
|
||||||
this.typingRefreshTimer = null;
|
this.typingRefreshTimer = null;
|
||||||
this.typingPauseTimer = null;
|
this.typingPauseTimer = null;
|
||||||
|
@ -323,8 +321,8 @@
|
||||||
|
|
||||||
isTyping: typingKeys.length > 0,
|
isTyping: typingKeys.length > 0,
|
||||||
lastMessage: {
|
lastMessage: {
|
||||||
status: this.lastMessageStatus,
|
status: this.get('lastMessageStatus'),
|
||||||
text: this.lastMessage,
|
text: this.get('lastMessage'),
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: () => this.trigger('select', this),
|
onClick: () => this.trigger('select', this),
|
||||||
|
@ -879,10 +877,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const message = this.addSingleMessage(messageWithSchema);
|
const message = this.addSingleMessage(messageWithSchema);
|
||||||
this.lastMessage = message.getNotificationText();
|
|
||||||
this.lastMessageStatus = 'sending';
|
|
||||||
|
|
||||||
this.set({
|
this.set({
|
||||||
|
lastMessage: message.getNotificationText(),
|
||||||
|
lastMessageStatus: 'sending',
|
||||||
active_at: now,
|
active_at: now,
|
||||||
timestamp: now,
|
timestamp: now,
|
||||||
});
|
});
|
||||||
|
@ -1154,17 +1152,6 @@
|
||||||
: null,
|
: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
let hasChanged = false;
|
|
||||||
const { lastMessage, lastMessageStatus } = lastMessageUpdate;
|
|
||||||
delete lastMessageUpdate.lastMessage;
|
|
||||||
delete lastMessageUpdate.lastMessageStatus;
|
|
||||||
|
|
||||||
hasChanged = hasChanged || lastMessage !== this.lastMessage;
|
|
||||||
this.lastMessage = lastMessage;
|
|
||||||
|
|
||||||
hasChanged = hasChanged || lastMessageStatus !== this.lastMessageStatus;
|
|
||||||
this.lastMessageStatus = lastMessageStatus;
|
|
||||||
|
|
||||||
// Because we're no longer using Backbone-integrated saves, we need to manually
|
// 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.
|
// clear the changed fields here so our hasChanged() check below is useful.
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
|
@ -1174,8 +1161,6 @@
|
||||||
await window.Signal.Data.updateConversation(this.id, this.attributes, {
|
await window.Signal.Data.updateConversation(this.id, this.attributes, {
|
||||||
Conversation: Whisper.Conversation,
|
Conversation: Whisper.Conversation,
|
||||||
});
|
});
|
||||||
} else if (hasChanged) {
|
|
||||||
this.trigger('change');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue