(js) Restore msgs selection after refresh

Fixes #4330
pull/218/merge
Francis Lachapelle 2017-11-09 18:17:45 -05:00
parent 2b9cc20689
commit 5ff28a37e2
2 changed files with 9 additions and 2 deletions

1
NEWS
View File

@ -28,6 +28,7 @@ Bug fixes
- [web] fixed XSRF cookie path when changing password (#4139) - [web] fixed XSRF cookie path when changing password (#4139)
- [web] spaces can now be inserted in address book names - [web] spaces can now be inserted in address book names
- [web] prevent the creation of empty contact categories - [web] prevent the creation of empty contact categories
- [web] restore messages selection after automatic refresh (#4330)
- [eas] hebrew folders encoding problem using EAS (#4240) - [eas] hebrew folders encoding problem using EAS (#4240)
- [eas] avoid sync requests for shared folders every second (#4275) - [eas] avoid sync requests for shared folders every second (#4275)

View File

@ -893,6 +893,7 @@
this.$futureMailboxData = futureMailboxData; this.$futureMailboxData = futureMailboxData;
this.$futureMailboxData.then(function(data) { this.$futureMailboxData.then(function(data) {
var selectedMessages = _.map(_this.$selectedMessages(), 'uid');
Mailbox.$timeout(function() { Mailbox.$timeout(function() {
var uids, headers; var uids, headers;
@ -916,7 +917,7 @@
// Instanciate Message objects // Instanciate Message objects
_.reduce(_this.uids, function(msgs, msg, i) { _.reduce(_this.uids, function(msgs, msg, i) {
var data; var data, msgObject;
if (_this.threaded) if (_this.threaded)
data = _.zipObject(uids, msg); data = _.zipObject(uids, msg);
else else
@ -925,7 +926,12 @@
// Build map of UID <=> index // Build map of UID <=> index
_this.uidsMap[data.uid] = i; _this.uidsMap[data.uid] = i;
msgs.push(new Mailbox.$Message(_this.$account.id, _this, data, true)); msgObject = new Mailbox.$Message(_this.$account.id, _this, data, true);
// Restore selection
msgObject.selected = selectedMessages.indexOf(msgObject.uid) > -1;
msgs.push(msgObject);
return msgs; return msgs;
}, _this.$messages); }, _this.$messages);