add linkedBoard Activities to selector

This commit is contained in:
Ben0it-T 2022-03-05 22:03:41 +01:00
parent d52e0bcb6e
commit bf6bfc8ed6
3 changed files with 26 additions and 4 deletions

View file

@ -773,7 +773,15 @@ Boards.helpers({
},
activities() {
return Activities.find({ boardId: this._id }, { sort: { createdAt: -1 } });
let linkedBoardId = [this._id];
Cards.find({
"type": "cardType-linkedBoard",
"boardId": this._id}
).forEach(card => {
linkedBoardId.push(card.linkedId);
});
return Activities.find({ boardId: { $in: linkedBoardId } }, { sort: { createdAt: -1 } });
//return Activities.find({ boardId: this._id }, { sort: { createdAt: -1 } });
},
activeMembers(){

View file

@ -14,9 +14,23 @@ Meteor.publish('activities', (kind, id, limit, hideSystem) => {
check(limit, Number);
check(hideSystem, Boolean);
// Get linkedBoard
let linkedElmtId = [id];
if (kind == 'board') {
Cards.find({
"type": "cardType-linkedBoard",
"boardId": id}
).forEach(card => {
linkedElmtId.push(card.linkedId);
});
}
//const selector = hideSystem
// ? { $and: [{ activityType: 'addComment' }, { [`${kind}Id`]: id }] }
// : { [`${kind}Id`]: id };
const selector = hideSystem
? { $and: [{ activityType: 'addComment' }, { [`${kind}Id`]: id }] }
: { [`${kind}Id`]: id };
? { $and: [{ activityType: 'addComment' }, { [`${kind}Id`]: { $in: linkedElmtId } }] }
: { [`${kind}Id`]: { $in: linkedElmtId } };
return Activities.find(selector, {
limit,
sort: { createdAt: -1 },

View file

@ -270,7 +270,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
checklists.push(cardId);
checklistItems.push(cardId);
parentCards.push(cardId);
cardCommentReactions.push(cardId)
cardCommentReactions.push(cardId);
},
);