Merge remote-tracking branch 'Angtrim/feature-duplicate' into edge

This commit is contained in:
Lauri Ojansivu 2019-04-06 08:46:40 +03:00
commit 56cccc6781
15 changed files with 221 additions and 26 deletions

View file

@ -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({