Migrate customFields

This commit is contained in:
Andrés Manelli 2019-03-08 23:39:33 +01:00
parent ff19d6744e
commit 4cd0d1c397
6 changed files with 24 additions and 10 deletions

View file

@ -2,7 +2,7 @@ BlazeComponent.extendComponent({
customFields() {
return CustomFields.find({
boardId: Session.get('currentBoard'),
boardIds: {$in: [Session.get('currentBoard')]},
});
},
@ -103,7 +103,6 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
evt.preventDefault();
const data = {
boardId: Session.get('currentBoard'),
name: this.find('.js-field-name').value.trim(),
type: this.type.get(),
settings: this.getSettings(),
@ -114,8 +113,10 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
// insert or update
if (!this.data()._id) {
data.boardIds = [Session.get('currentBoard')];
CustomFields.insert(data);
} else {
data.boardIds = {$in: [Session.get('currentBoard')]};
CustomFields.update(this.data()._id, {$set: data});
}