Expiring messages: Add clarifying comment about destroy() ordering

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-08-04 11:45:49 -07:00
parent 7d4ae63501
commit 832b343031

View file

@ -12,6 +12,9 @@
expired.on('add', function(message) {
console.log('message', message.get('sent_at'), 'expired');
message.getConversation().trigger('expired', message);
// We delete after the trigger to allow the conversation time to process
// the expiration before the message is removed from the database.
message.destroy();
});
expired.on('reset', checkExpiringMessages);