Merge branch 'GhassenRjab-hotfix/sort-checklists-items' into devel

Fix: Checklist items are lost when moving items to
another checklist. Thanks to GhassenRjab ! Related #876
This commit is contained in:
Lauri Ojansivu 2017-09-23 08:10:48 +03:00
commit 5f697eac05
2 changed files with 33 additions and 1 deletions

View file

@ -1,9 +1,15 @@
# Upcoming Wekan release # Upcoming Wekan release
This release adds the following new features:
* [Add translations (en/de/fi) for email notifications regarding checklists and checklist * [Add translations (en/de/fi) for email notifications regarding checklists and checklist
items](https://github.com/wekan/wekan/pull/1238). items](https://github.com/wekan/wekan/pull/1238).
Thanks to GitHub users umbertooo and xet7 for their contributions. and fixes the following bugs:
* [Checklist items are lost when moving items to another checklist](https://github.com/wekan/wekan/pull/1240).
Thanks to GitHub users GhassenRjab, umbertooo and xet7 for their contributions.
# v0.39 2017-09-18 Wekan release # v0.39 2017-09-18 Wekan release

View file

@ -130,3 +130,29 @@ Migrations.add('add-member-isactive-field', () => {
Boards.update(board._id, {$set: {members: newMemberSet}}, noValidate); Boards.update(board._id, {$set: {members: newMemberSet}}, noValidate);
}); });
}); });
Migrations.add('add-sort-checklists', () => {
Checklists.find().forEach((checklist, index) => {
if (!checklist.hasOwnProperty('sort')) {
Checklists.direct.update(
checklist._id,
{
$set: {
sort: index,
newItemIndex: checklist.items.length,
},
},
noValidate
);
}
checklist.items.forEach(function(item, index) {
if (!item.hasOwnProperty('sort')) {
Checklists.direct.update(
{ _id: checklist._id, 'items._id': item._id },
{ $set: { 'items.$.sort': index } },
noValidate
);
}
});
});
});