adds card comment reactions feature

This commit is contained in:
Kai Lehmann 2021-08-13 20:47:55 +02:00
parent d8e8512d66
commit 2977120129
8 changed files with 239 additions and 10 deletions

View file

@ -129,6 +129,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
this.cursor(Lists.find({ boardId, archived: isArchived }));
this.cursor(Swimlanes.find({ boardId, archived: isArchived }));
this.cursor(Integrations.find({ boardId }));
this.cursor(CardCommentReactions.find({ boardId }));
this.cursor(
CustomFields.find(
{ boardIds: { $in: [boardId] } },
@ -161,6 +162,8 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
// Gather queries and send in bulk
const cardComments = this.join(CardComments);
cardComments.selector = _ids => ({ cardId: _ids });
const cardCommentReactions = this.join(CardCommentReactions);
cardCommentReactions.selector = _ids => ({ cardId: _ids });
const attachments = this.join(Attachments);
attachments.selector = _ids => ({ cardId: _ids });
const checklists = this.join(Checklists);
@ -194,12 +197,14 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
checklists.push(cardId);
checklistItems.push(cardId);
parentCards.push(cardId);
cardCommentReactions.push(cardId)
},
);
// Send bulk queries for all found ids
subCards.send();
cardComments.send();
cardCommentReactions.send();
attachments.send();
checklists.send();
checklistItems.send();

View file

@ -5,6 +5,7 @@ import Lists from '../../models/lists';
import Swimlanes from '../../models/swimlanes';
import Cards from '../../models/cards';
import CardComments from '../../models/cardComments';
import CardCommentReactions from '../../models/cardCommentReactions';
import Attachments from '../../models/attachments';
import Checklists from '../../models/checklists';
import ChecklistItems from '../../models/checklistItems';
@ -699,6 +700,8 @@ function findCards(sessionId, query) {
type: 1,
};
const comments = CardComments.find({ cardId: { $in: cards.map(c => c._id) } });
return [
cards,
Boards.find(
@ -714,7 +717,8 @@ function findCards(sessionId, query) {
Users.find({ _id: { $in: users } }, { fields: Users.safeFields }),
Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),
Attachments.find({ cardId: { $in: cards.map(c => c._id) } }),
CardComments.find({ cardId: { $in: cards.map(c => c._id) } }),
comments,
CardCommentReactions.find({cardCommentId: {$in: comments.map(c => c._id) }}),
SessionData.find({ userId, sessionId }),
];
}