Ensure final message before 'empty' is ready for notification (#1522)
Without this change, there's a race condition for the notification we show when we get the 'empty' event after a large backlog download. Four messages may have come in, but the last might not be notified. So the count shown would be three. And then, when the final message's notify() call finishes, another notification would be shown. FREEBIE
This commit is contained in:
@@ -493,12 +493,16 @@
|
||||
// because we need to start expiration timers, etc.
|
||||
message.markRead();
|
||||
}
|
||||
if (message.get('unread')) {
|
||||
conversation.notify(message);
|
||||
}
|
||||
|
||||
confirm();
|
||||
return resolve();
|
||||
if (message.get('unread')) {
|
||||
conversation.notify(message).then(function() {
|
||||
confirm();
|
||||
return resolve();
|
||||
}, handleError);
|
||||
} else {
|
||||
confirm();
|
||||
return resolve();
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
handleError(e);
|
||||
|
Reference in New Issue
Block a user