Update contents of conversation even when view not hydrated
Also ensure that we update the last message in a conversation after expire, after the mesage is really deleted from the database.
This commit is contained in:
parent
4415293100
commit
12b5547e72
3 changed files with 39 additions and 31 deletions
|
@ -5,7 +5,7 @@
|
|||
function destroyExpiredMessages() {
|
||||
// Load messages that have expired and destroy them
|
||||
var expired = new Whisper.MessageCollection();
|
||||
expired.on('add', function(message) {
|
||||
expired.on('add', async function(message) {
|
||||
console.log('Message expired', {
|
||||
sentAt: message.get('sent_at'),
|
||||
});
|
||||
|
@ -16,7 +16,10 @@
|
|||
|
||||
// We delete after the trigger to allow the conversation time to process
|
||||
// the expiration before the message is removed from the database.
|
||||
message.destroy();
|
||||
await wrapDeferred(message.destroy());
|
||||
if (conversation) {
|
||||
conversation.updateLastMessage();
|
||||
}
|
||||
});
|
||||
expired.on('reset', throttledCheckExpiringMessages);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue