diff options
Diffstat (limited to 'client/components/sidebar/sidebarCustomFields.js')
-rw-r--r-- | client/components/sidebar/sidebarCustomFields.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/components/sidebar/sidebarCustomFields.js b/client/components/sidebar/sidebarCustomFields.js index bdd8e7a0..81147ce5 100644 --- a/client/components/sidebar/sidebarCustomFields.js +++ b/client/components/sidebar/sidebarCustomFields.js @@ -116,15 +116,22 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({ data.boardIds = [Session.get('currentBoard')]; CustomFields.insert(data); } else { - data.boardIds = {$in: [Session.get('currentBoard')]}; CustomFields.update(this.data()._id, {$set: data}); } Popup.back(); }, 'click .js-delete-custom-field': Popup.afterConfirm('deleteCustomField', function() { - const customFieldId = this._id; - CustomFields.remove(customFieldId); + const customField = CustomFields.findOne(this._id); + if (customField.boardIds.length > 1) { + CustomFields.update(customField._id, { + $pull: { + boardIds: Session.get('currentBoard') + } + }); + } else { + CustomFields.remove(customField._id); + } Popup.close(); }), }]; |