Skip to content

Commit

Permalink
fix(addressbook(js)): load selected cards prior to display mail editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Sep 21, 2021
1 parent 9c493e0 commit c6d6dc3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
9 changes: 8 additions & 1 deletion UI/WebServerResources/js/Contacts/AddressBook.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,10 @@
* @param {promise} futureHeadersData - a promise of the metadata of some cards
*/
AddressBook.prototype.$unwrapHeaders = function(futureHeadersData) {
var _this = this;
var _this = this,
deferred = AddressBook.$q.defer();

this.$futureHeadersData = deferred.promise;
futureHeadersData.then(function(data) {
AddressBook.$timeout(function() {
var headers, j;
Expand All @@ -867,8 +869,13 @@
}
});
}
deferred.resolve(_this.$cards);
});
}, function() {
deferred.reject();
});

return this.$futureHeadersData;
};

/**
Expand Down
17 changes: 15 additions & 2 deletions UI/WebServerResources/js/Contacts/AddressBookController.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
};

this.newMessageWithSelectedCards = function($event, recipientsField) {
var selectedFolder = this.selectedFolder;
var selectedCards = _.filter(this.selectedFolder.$cards, function(card) { return card.selected; });
var promises = [], recipients = [];

Expand All @@ -401,8 +402,20 @@
}));
}
}
else if (card.c_mail.length) {
recipients.push(card.$shortFormat());
else if (card.$loaded == Card.STATUS.LOADED) {
if (card.c_mail) {
recipients.push(card.$shortFormat());
}
}
else if (selectedFolder.$loadCard(card)) {
promises.push(selectedFolder.$futureHeadersData.then(function() {
var i = selectedFolder.idsMap[card.id];
if (angular.isDefined(i)) {
var loadedCard = selectedFolder.$cards[i];
if (loadedCard.c_mail)
recipients.push(loadedCard.$shortFormat());
}
}));
}
});

Expand Down

0 comments on commit c6d6dc3

Please sign in to comment.