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

@ -363,12 +363,12 @@ if (Meteor.isServer) {
if (value) params[key] = value;
});
if (board) {
const activeMemberIds = _.filter(board.members || [], m => m.isActive === true).map(m => m.userId);
const BIGEVENTS = process.env.BIGEVENTS_PATTERN; // if environment BIGEVENTS_PATTERN is set, any activityType matching it is important
if (BIGEVENTS) {
try {
const atype = activity.activityType;
if (new RegExp(BIGEVENTS).exec(atype)) {
const activeMemberIds = _.filter(board.members, m => m.isActive === true).map(m => m.userId);
watchers = _.union(watchers, activeMemberIds); // notify all active members for important events
}
} catch (e) {
@ -393,6 +393,9 @@ if (Meteor.isServer) {
_.intersection(participants, trackingUsers),
);
}
// Ensure notifications only go to active members of the current board.
watchers = _.intersection(watchers, activeMemberIds);
}
(await Notifications.getUsers(watchers)).forEach((user) => {
// Skip if user is undefined or doesn't have an _id (e.g., deleted user or invalid ID)