From 6921452a7d6584b0e9cb1bccb4f0937315c841a8 Mon Sep 17 00:00:00 2001 From: Ghassen Rjab Date: Fri, 22 Sep 2017 22:35:07 +0100 Subject: [PATCH 1/3] Add migration script to add sort field to checklists and their items --- server/migrations.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/server/migrations.js b/server/migrations.js index 99125976c..2a99f564b 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -130,3 +130,29 @@ Migrations.add('add-member-isactive-field', () => { 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 + ); + } + }); + }); +}); From 20ba743f9b8a480eab963e585fdfa4c9a16fc9f0 Mon Sep 17 00:00:00 2001 From: Ghassen Rjab Date: Sat, 23 Sep 2017 01:02:44 +0100 Subject: [PATCH 2/3] Fix lint errors --- server/migrations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/migrations.js b/server/migrations.js index 2a99f564b..40420e8ed 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -140,7 +140,7 @@ Migrations.add('add-sort-checklists', () => { $set: { sort: index, newItemIndex: checklist.items.length, - } + }, }, noValidate ); @@ -148,8 +148,8 @@ Migrations.add('add-sort-checklists', () => { checklist.items.forEach(function(item, index) { if (!item.hasOwnProperty('sort')) { Checklists.direct.update( - { _id: checklist._id, "items._id": item._id }, - { $set: { "items.$.sort": index } }, + { _id: checklist._id, 'items._id': item._id }, + { $set: { 'items.$.sort': index } }, noValidate ); } From e97c2c7bf0ab3213d0ac060af474367effe68af7 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sat, 23 Sep 2017 07:52:43 +0300 Subject: [PATCH 3/3] Add migration script to add sort field to checklists and their items. Thanks to GhassenRjab ! Related #876 --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d59528b5..2c7add5d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # Upcoming Wekan release +This release adds the following new features: + * [Add translations (en/de/fi) for email notifications regarding checklists and checklist 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