- [Fix deleting Custom Fields, removing broken references](https://github.com/wekan/wekan/issues/1872).

Thanks to Akuket and Clement87 !
This commit is contained in:
Lauri Ojansivu 2018-10-13 23:51:54 +03:00
parent bedd3767ce
commit 8cd5f7c185
2 changed files with 24 additions and 0 deletions

View file

@ -71,6 +71,12 @@ if (Meteor.isServer) {
Activities.remove({
customFieldId: doc._id,
});
Cards.update(
{'boardId': doc.boardId, 'customFields._id': doc._id},
{$pull: {'customFields': {'_id': doc._id}}},
{multi: true}
);
});
}

View file

@ -321,3 +321,21 @@ Migrations.add('add-subtasks-allowed', () => {
},
}, noValidateMulti);
});
Migrations.add('remove-tag', () => {
Users.update({
}, {
$unset: {
'profile.tags':1,
},
}, noValidateMulti);
});
Migrations.add('remove-customFields-references-broken', () => {
Cards.update({'customFields.$value': null},
{ $pull: {
customFields: {value: null},
},
}, noValidateMulti);
});