2016-01-05 23:26:02 +08:00
|
|
|
Meteor.startup(() => {
|
2020-03-27 11:35:03 -06:00
|
|
|
Notifications.subscribe('profile', (user, title, description, params) => {
|
2026-01-20 02:28:32 +02:00
|
|
|
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);
|
|
|
|
|
}
|
2020-03-27 11:35:03 -06:00
|
|
|
});
|
2016-01-05 23:26:02 +08:00
|
|
|
});
|