From a370e6aca38881f38c6d068bbcd6302401bb8ae7 Mon Sep 17 00:00:00 2001 From: Florent MONTHEL Date: Tue, 21 Feb 2017 00:06:11 -0500 Subject: [BUG] Bug when we're removing user from board that generate activity for all the card of the board --- models/cards.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index f6bd0b06..ab735ad0 100644 --- a/models/cards.js +++ b/models/cards.js @@ -340,13 +340,16 @@ if (Meteor.isServer) { // Say goodbye to the former member if (modifier.$pull && modifier.$pull.members) { memberId = modifier.$pull.members; - Activities.insert({ - userId, - memberId, - activityType: 'unjoinMember', - boardId: doc.boardId, - cardId: doc._id, - }); + // Check that the former member is member of the card + if (_.contains(doc.members, memberId)) { + Activities.insert({ + userId, + memberId, + activityType: 'unjoinMember', + boardId: doc.boardId, + cardId: doc._id, + }); + } } }); -- cgit v1.2.3-1-g7c22