Bladeren bron

Merge pull request #4315 from Ben0it-T/fix-cardType-linkedBoard-comments-not-loading

Fix comments not loading on cardType-linkedBoard
Lauri Ojansivu 3 jaren geleden
bovenliggende
commit
d63fa4aa89
2 gewijzigde bestanden met toevoegingen van 13 en 0 verwijderingen
  1. 5 0
      models/cards.js
  2. 8 0
      server/publications/boards.js

+ 5 - 0
models/cards.js

@@ -721,6 +721,11 @@ Cards.helpers({
         { cardId: this.linkedId },
         { sort: { createdAt: -1 } },
       );
+    } else if (this.isLinkedBoard()) {
+      return CardComments.find(
+        { boardId: this.linkedId },
+        { sort: { createdAt: -1 } },
+      );
     } else {
       return CardComments.find(
         { cardId: this._id },

+ 8 - 0
server/publications/boards.js

@@ -229,6 +229,8 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
       // Gather queries and send in bulk
       const cardComments = this.join(CardComments);
       cardComments.selector = _ids => ({ cardId: _ids });
+      const cardCommentsLinkedBoard = this.join(CardComments);
+      cardCommentsLinkedBoard.selector = _ids => ({ boardId: _ids });
       const cardCommentReactions = this.join(CardCommentReactions);
       cardCommentReactions.selector = _ids => ({ cardId: _ids });
       const attachments = this.join(Attachments);
@@ -242,6 +244,8 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
       const boards = this.join(Boards);
       const subCards = this.join(Cards);
       subCards.selector = _ids => ({ _id: _ids, archived: isArchived });
+      const linkedBoardCards = this.join(Cards);
+      linkedBoardCards.selector = _ids => ({ boardId: _ids });
 
       this.cursor(
         Cards.find({
@@ -258,6 +262,8 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
             checklistItems.push(impCardId);
           } else if (card.type === 'cardType-linkedBoard') {
             boards.push(card.linkedId);
+            linkedBoardCards.push(card.linkedId);
+            cardCommentsLinkedBoard.push(card.linkedId);
           }
           cardComments.push(cardId);
           attachments.push(cardId);
@@ -277,6 +283,8 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
       checklistItems.send();
       boards.send();
       parentCards.send();
+      linkedBoardCards.send();
+      cardCommentsLinkedBoard.send();
 
       if (board.members) {
         // Board members. This publication also includes former board members that