summaryrefslogtreecommitdiffstats
path: root/models/wekanCreator.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-04-06 08:46:40 +0300
committerLauri Ojansivu <x@xet7.org>2019-04-06 08:46:40 +0300
commit56cccc678107a94d4cadb13f3b6138cef93a18b0 (patch)
treec3bef1326c7d328506e3bc38e6223fbf3f205c25 /models/wekanCreator.js
parentb680bb53725103f186ac1c7cb604fbd4a5773051 (diff)
parent48216e16537d50a27579c545c93624c0302a5a78 (diff)
downloadwekan-56cccc678107a94d4cadb13f3b6138cef93a18b0.tar.gz
wekan-56cccc678107a94d4cadb13f3b6138cef93a18b0.tar.bz2
wekan-56cccc678107a94d4cadb13f3b6138cef93a18b0.zip
Merge remote-tracking branch 'Angtrim/feature-duplicate' into edge
Diffstat (limited to 'models/wekanCreator.js')
-rw-r--r--models/wekanCreator.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/models/wekanCreator.js b/models/wekanCreator.js
index 3a627424..d0494a76 100644
--- a/models/wekanCreator.js
+++ b/models/wekanCreator.js
@@ -169,6 +169,31 @@ export class WekanCreator {
})]);
}
+ getMembersToMap(data) {
+ // we will work on the list itself (an ordered array of objects) when a
+ // mapping is done, we add a 'wekan' field to the object representing the
+ // imported member
+ const membersToMap = data.members;
+ const users = data.users;
+ // auto-map based on username
+ membersToMap.forEach((importedMember) => {
+ importedMember.id = importedMember.userId;
+ delete importedMember.userId;
+ const user = users.filter((user) => {
+ return user._id === importedMember.id;
+ })[0];
+ if (user.profile && user.profile.fullname) {
+ importedMember.fullName = user.profile.fullname;
+ }
+ importedMember.username = user.username;
+ const wekanUser = Users.findOne({ username: importedMember.username });
+ if (wekanUser) {
+ importedMember.wekanId = wekanUser._id;
+ }
+ });
+ return membersToMap;
+ }
+
checkActions(wekanActions) {
// XXX More check based on action type
check(wekanActions, [Match.ObjectIncluding({