Fixed Add member and @mentions.

Thanks to xet7 !

Fixes #6076,
fixes #6077
This commit is contained in:
Lauri Ojansivu 2026-01-20 02:28:32 +02:00
parent 603a65ef17
commit ad511bd137
14 changed files with 413 additions and 149 deletions

View file

@ -23,12 +23,15 @@ Notifications = {
const users = [];
watchers.forEach(userId => {
const user = ReactiveCache.getUser(userId);
if (user) users.push(user);
if (user && user._id) users.push(user);
});
return users;
},
notify: (user, title, description, params) => {
// Skip if user is invalid
if (!user || !user._id) return;
for (const k in notifyServices) {
const notifyImpl = notifyServices[k];
if (notifyImpl && typeof notifyImpl === 'function')

View file

@ -1,5 +1,15 @@
Meteor.startup(() => {
Notifications.subscribe('profile', (user, title, description, params) => {
user.addNotification(params.activityId);
try {
// Validate user object before processing
if (!user || !user._id) {
console.error('Invalid user object in notification:', { user, title, params });
return;
}
const modifier = user.addNotification(params.activityId);
Users.direct.update(user._id, modifier);
} catch (error) {
console.error('Error adding notification:', error);
}
});
});