Skip to content

Commit

Permalink
fix(addressbook(js)): custom field creation
Browse files Browse the repository at this point in the history
availableKeys will always be an array containing ["1", "2", "3", "4"]
because currently the wrong customFields is not accessed correctly.

This leads to the removal of CUSTOM1 if you wanna add a second custom
field.
  • Loading branch information
Conni2461 committed Nov 25, 2021
1 parent 841dc68 commit fc121ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions UI/WebServerResources/js/Contacts/CardController.js
Expand Up @@ -103,15 +103,15 @@
};

this.canAddCustomField = function () {
return _.keys(this.customFields).length < 4;
return _.keys(this.card.customFields).length < 4;
};

this.addCustomField = function () {
if (!angular.isDefined(this.card.customFields))
this.card.customFields = {};

// Find the first 'available' custom field
var availableKeys = _.pullAll(['1', '2', '3', '4'], _.keys(this.customFields));
var availableKeys = _.pullAll(['1', '2', '3', '4'], _.keys(this.card.customFields));
this.card.customFields[availableKeys[0]] = "";
};

Expand Down

0 comments on commit fc121ac

Please sign in to comment.