fix(mail(js)): update visible msgs list when adding new msgs

pull/299/head
Francis Lachapelle 2021-06-30 11:20:29 -04:00
parent a8c684cdad
commit 0599922016
1 changed files with 6 additions and 4 deletions

View File

@ -980,7 +980,7 @@
this.$futureMailboxData.then(function(data) {
var selectedMessages = _.map(_this.$selectedMessages, 'uid');
Mailbox.$timeout(function() {
var uids, headers, headersFields, msgObject;
var uids, headers, headersFields, msgObject, hasNewMessages = false;
if (!data.uids || _this.$topIndex > data.uids.length - 1)
_this.$topIndex = 0;
@ -1004,6 +1004,7 @@
// New messsage; update map of UID <=> index
_this.uidsMap[uid] = i;
_this.$messages.splice(i, 0, {uid: uid});
hasNewMessages = true;
i++;
}
});
@ -1014,9 +1015,6 @@
msgObject = _this.$messages[j];
_this.uidsMap[msgObject.uid] += i;
}
if (_this.threaded) {
_this.updateVisibleMessages();
}
}
}
if (data.unseenCount) {
@ -1090,6 +1088,10 @@
});
}
if (hasNewMessages && _this.threaded) {
_this.updateVisibleMessages();
}
Mailbox.$log.debug('mailbox ' + _this.id + ' ready');
_this.$isLoading = false;
deferred.resolve(_this.$messages);