diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2018-04-18 01:35:46 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2018-08-11 00:07:29 +0200 |
commit | 74a01691e3490675d78cc4f24b3b99959e702c8d (patch) | |
tree | d1a47dcad555380da7cd412b594536acf86ac5b6 /models/cards.js | |
parent | 49c415f0239d6645c41881690acfb2a18395fae8 (diff) | |
download | wekan-74a01691e3490675d78cc4f24b3b99959e702c8d.tar.gz wekan-74a01691e3490675d78cc4f24b3b99959e702c8d.tar.bz2 wekan-74a01691e3490675d78cc4f24b3b99959e702c8d.zip |
Add two way binding of activities, comments, and attachments
Diffstat (limited to 'models/cards.js')
-rw-r--r-- | models/cards.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/models/cards.js b/models/cards.js index 9a715ca3..b295a4fe 100644 --- a/models/cards.js +++ b/models/cards.js @@ -181,19 +181,33 @@ Cards.helpers({ }, isAssigned(memberId) { - return _.contains(this.members, memberId); + return _.contains(this.getMembers(), memberId); }, activities() { - return Activities.find({cardId: this._id}, {sort: {createdAt: -1}}); + if (this.isImportedCard()) { + return Activities.find({cardId: this.importedId}, {sort: {createdAt: -1}}); + } else if (this.isImportedBoard()) { + return Activities.find({boardId: this.importedId}, {sort: {createdAt: -1}}); + } else { + return Activities.find({cardId: this._id}, {sort: {createdAt: -1}}); + } }, comments() { - return CardComments.find({cardId: this._id}, {sort: {createdAt: -1}}); + if (this.isImportedCard()) { + return CardComments.find({cardId: this.importedId}, {sort: {createdAt: -1}}); + } else { + return CardComments.find({cardId: this._id}, {sort: {createdAt: -1}}); + } }, attachments() { - return Attachments.find({cardId: this._id}, {sort: {uploadedAt: -1}}); + if (this.isImportedCard()) { + return Attachments.find({cardId: this.importedId}, {sort: {uploadedAt: -1}}); + } else { + return Attachments.find({cardId: this._id}, {sort: {uploadedAt: -1}}); + } }, cover() { |