Fix Notifications from not allowed Boards.

Thanks to FK-PATZ3 and xet7 !

Fixes #6103
This commit is contained in:
Lauri Ojansivu 2026-02-20 00:28:33 +02:00
parent 6903e12112
commit a34c2f35a6
2 changed files with 20 additions and 1 deletions

View file

@ -2098,6 +2098,10 @@ Cards.helpers({
);
const newBoard = ReactiveCache.getBoard(boardId);
const allowedMemberIds = _.pluck(
_.filter(newBoard.members || [], member => member.isActive === true),
'userId',
);
const newBoardLabels = newBoard.labels;
const newCardLabelIds = _.pluck(
_.filter(newBoardLabels, label => {
@ -2119,6 +2123,18 @@ Cards.helpers({
if (!Array.isArray(mutatedFields.customFields)) {
mutatedFields.customFields = [];
}
const currentMembers = Array.isArray(this.members) ? this.members : [];
const filteredMembers = currentMembers.filter(memberId => allowedMemberIds.includes(memberId));
if (_.difference(currentMembers, filteredMembers).length > 0) {
mutatedFields.members = filteredMembers;
}
const currentWatchers = Array.isArray(this.watchers) ? this.watchers : [];
const filteredWatchers = currentWatchers.filter(watcherId => allowedMemberIds.includes(watcherId));
if (_.difference(currentWatchers, filteredWatchers).length > 0) {
mutatedFields.watchers = filteredWatchers;
}
}
Cards.updateAsync(this._id, { $set: mutatedFields });