Skip to content

Commit

Permalink
(js) Restore cards selection after refresh
Browse files Browse the repository at this point in the history
Fixes #4809
  • Loading branch information
cgx committed Sep 26, 2019
1 parent ac9fa92 commit 249277e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -20,6 +20,7 @@ Bug fixes
- [web] fixed saving value of receipt action for main IMAP account
- [web] fixed search results in Calendar module when targeting all events
- [web] properly encode URL of cards from exteral sources
- [web] restore cards selection after automatic refresh (#4809)
- [core] honor IMAPLoginFieldName also when setting IMAP ACLs
- [core] honor groups when setting IMAP ACLs
- [core] honor "any authenticated user" when setting IMAP ACLs
Expand Down
10 changes: 8 additions & 2 deletions UI/WebServerResources/js/Contacts/AddressBook.service.js
Expand Up @@ -757,6 +757,7 @@

// Expose and resolve the promise
this.$futureAddressBookData = futureAddressBookData.then(function(response) {
var selectedCards = _.map(_this.$selectedCards(), 'id');
return AddressBook.$timeout(function() {
var headers;

Expand All @@ -779,12 +780,17 @@

// Instanciate Card objects
_.reduce(_this.ids, function(cards, card, i) {
var data = { pid: _this.id, id: card };
var data = { pid: _this.id, id: card }, cardObject;

// Build map of ID <=> index
_this.idsMap[data.id] = i;

cards.push(new AddressBook.$Card(data));
cardObject = new AddressBook.$Card(data);

// Restore selection
cardObject.selected = selectedCards.indexOf(cardObject.id) > -1;

cards.push(cardObject);

return cards;
}, _this.$cards);
Expand Down

0 comments on commit 249277e

Please sign in to comment.