summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGhassen Rjab <rjab.ghassen@gmail.com>2017-09-02 13:18:29 +0100
committerGhassen Rjab <rjab.ghassen@gmail.com>2017-09-02 13:18:29 +0100
commit255df20da068a203589dba15a5ad249183cd50f5 (patch)
treeb306e742226510bdb7ec9d05a6e40ce30c87e53e /models
parentbc4ea6fd9a6e05965ae3977e6453ce1d36ce4078 (diff)
downloadwekan-255df20da068a203589dba15a5ad249183cd50f5.tar.gz
wekan-255df20da068a203589dba15a5ad249183cd50f5.tar.bz2
wekan-255df20da068a203589dba15a5ad249183cd50f5.zip
Put 'this' in 'self' variable
For some reason, TrelloCreator didn't keep 'this' reference
Diffstat (limited to 'models')
-rw-r--r--models/trelloCreator.js5
-rw-r--r--models/wekanCreator.js7
2 files changed, 7 insertions, 5 deletions
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index 33d777be..4f64edd6 100644
--- a/models/trelloCreator.js
+++ b/models/trelloCreator.js
@@ -318,11 +318,12 @@ export class TrelloCreator {
// - HEAD returns null, which causes exception down the line
// - the template then tries to display the url to the attachment which causes other errors
// so we make it server only, and let UI catch up once it is done, forget about latency comp.
+ const self = this;
if(Meteor.isServer) {
file.attachData(att.url, function (error) {
file.boardId = boardId;
file.cardId = cardId;
- file.userId = this._user(att.idMemberCreator);
+ file.userId = self._user(att.idMemberCreator);
// The field source will only be used to prevent adding
// attachments' related activities automatically
file.source = 'import';
@@ -332,7 +333,7 @@ export class TrelloCreator {
const wekanAtt = Attachments.insert(file, () => {
// we do nothing
});
- this.attachmentIds[att.id] = wekanAtt._id;
+ self.attachmentIds[att.id] = wekanAtt._id;
//
if(trelloCoverId === att.id) {
Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
diff --git a/models/wekanCreator.js b/models/wekanCreator.js
index 3d0a2397..7e320817 100644
--- a/models/wekanCreator.js
+++ b/models/wekanCreator.js
@@ -307,12 +307,13 @@ export class WekanCreator {
// - HEAD returns null, which causes exception down the line
// - the template then tries to display the url to the attachment which causes other errors
// so we make it server only, and let UI catch up once it is done, forget about latency comp.
+ const self = this;
if(Meteor.isServer) {
if (att.url) {
file.attachData(att.url, function (error) {
file.boardId = boardId;
file.cardId = cardId;
- file.userId = this._user(att.userId);
+ file.userId = self._user(att.userId);
// The field source will only be used to prevent adding
// attachments' related activities automatically
file.source = 'import';
@@ -322,7 +323,7 @@ export class WekanCreator {
const wekanAtt = Attachments.insert(file, () => {
// we do nothing
});
- this.attachmentIds[att._id] = wekanAtt._id;
+ self.attachmentIds[att._id] = wekanAtt._id;
//
if(wekanCoverId === att._id) {
Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
@@ -334,7 +335,7 @@ export class WekanCreator {
file.name(att.name);
file.boardId = boardId;
file.cardId = cardId;
- file.userId = this._user(att.userId);
+ file.userId = self._user(att.userId);
// The field source will only be used to prevent adding
// attachments' related activities automatically
file.source = 'import';