(js) Fix sorting after renaming an AddressBook

pull/228/head
Francis Lachapelle 2016-12-02 14:48:59 -05:00
parent 41701cc94c
commit 6ce64a9a27
2 changed files with 10 additions and 2 deletions

1
NEWS
View File

@ -3,6 +3,7 @@
Bug fixes
- [web] fixed confusion between owner and active user in ACLs management of Administration module
- [web] fixed JavaScript exception after renaming an address book
3.2.4 (2016-12-01)
------------------

View File

@ -583,10 +583,14 @@
* @returns a promise of the HTTP operation
*/
AddressBook.prototype.$rename = function(name) {
var i = _.indexOf(_.map(AddressBook.$addressbooks, 'id'), this.id);
var i, list;
list = this.isSubscription? AddressBook.$subscriptions : AddressBook.$addressbooks;
i = _.indexOf(_.map(list, 'id'), this.id);
this.name = name;
AddressBook.$addressbooks.splice(i, 1);
list.splice(i, 1);
AddressBook.$add(this);
return this.$save();
};
@ -848,7 +852,10 @@
var addressbook = {};
angular.forEach(this, function(value, key) {
if (key != 'constructor' &&
key != 'acls' &&
key != 'ids' &&
key != 'idsMap' &&
key != 'urls' &&
key[0] != '$') {
addressbook[key] = value;
}