summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2016-01-31 15:13:03 +0100
committerMaxime Quandalle <maxime@quandalle.com>2016-01-31 20:03:17 +0100
commitb5ebbd2bf95eef6fdc4f7a5fdaf5ef4e3b4ec5b5 (patch)
tree7d44b85dff8a1b47aca729b2cca42cd6d62941f8
parenta13fad749e8a75025bb13de87f0170e1ea9e462d (diff)
downloadwekan-b5ebbd2bf95eef6fdc4f7a5fdaf5ef4e3b4ec5b5.tar.gz
wekan-b5ebbd2bf95eef6fdc4f7a5fdaf5ef4e3b4ec5b5.tar.bz2
wekan-b5ebbd2bf95eef6fdc4f7a5fdaf5ef4e3b4ec5b5.zip
Simplify an internal data model used in the importer
We used to save the whole user document in a internal data structure while we only needed the userId.
-rw-r--r--client/components/import/import.jade6
-rw-r--r--client/components/import/import.js23
2 files changed, 14 insertions, 15 deletions
diff --git a/client/components/import/import.jade b/client/components/import/import.jade
index 816a0b45..e10072b4 100644
--- a/client/components/import/import.jade
+++ b/client/components/import/import.jade
@@ -23,14 +23,14 @@ template(name="importMapMembers")
p {{_ 'import-members-map'}}
.mapping-list
each members
- a.mapping-item.js-select-member(class="{{#if wekan}}filled{{/if}}")
+ a.mapping-item.js-select-member(class="{{#if wekanId}}filled{{/if}}")
.profile-source
.full-name= fullName
.username
| ({{username}})
.wekan
- if wekan
- +userAvatar(userId=wekan._id)
+ if wekanId
+ +userAvatar(userId=wekanId)
else
a.member.add-member
i.fa.fa-plus
diff --git a/client/components/import/import.js b/client/components/import/import.js
index 169f9dd0..11a5308a 100644
--- a/client/components/import/import.js
+++ b/client/components/import/import.js
@@ -44,8 +44,8 @@ BlazeComponent.extendComponent({
if (membersMapping) {
const mappingById = {};
membersMapping.forEach((member) => {
- if (member.wekan) {
- mappingById[member.id] = member.wekan._id;
+ if (member.wekanId) {
+ mappingById[member.id] = member.wekanId;
}
});
additionalData.membersMapping = mappingById;
@@ -71,7 +71,7 @@ BlazeComponent.extendComponent({
membersToMap.forEach((importedMember) => {
const wekanUser = Users.findOne({ username: importedMember.username });
if (wekanUser) {
- importedMember.wekan = wekanUser;
+ importedMember.wekanId = wekanUser._id;
}
});
// store members data and mapping in Session
@@ -102,10 +102,9 @@ BlazeComponent.extendComponent({
BlazeComponent.extendComponent({
onCreated() {
this.autorun(() => {
- this.parentComponent().membersToMap.get().forEach(({ wekan }) => {
- if (wekan !== undefined) {
- const userId = wekan._id;
- this.subscribe('user-miniprofile', userId);
+ this.parentComponent().membersToMap.get().forEach(({ wekanId }) => {
+ if (wekanId) {
+ this.subscribe('user-miniprofile', wekanId);
}
});
});
@@ -168,7 +167,7 @@ BlazeComponent.extendComponent({
getMember(memberId = null) {
const allMembers = this.members();
let finder = null;
- if(memberId) {
+ if (memberId) {
finder = (user) => user.id === memberId;
} else {
finder = (user) => user.selected;
@@ -176,12 +175,12 @@ BlazeComponent.extendComponent({
return allMembers.find(finder);
},
- mapSelectedMember(wekan) {
- return this._setPropertyForMember('wekan', wekan, null);
+ mapSelectedMember(wekanId) {
+ return this._setPropertyForMember('wekanId', wekanId, null);
},
unmapMember(memberId){
- return this._setPropertyForMember('wekan', null, memberId);
+ return this._setPropertyForMember('wekanId', null, memberId);
},
onSubmit(evt) {
@@ -214,7 +213,7 @@ BlazeComponent.extendComponent({
},
onSelectUser(){
- Popup.getOpenerComponent().mapSelectedMember(this.currentData());
+ Popup.getOpenerComponent().mapSelectedMember(this.currentData()._id);
Popup.back();
},