fix avatar if Meteor.user() is undefined

This commit is contained in:
Martin Filser 2023-03-26 09:50:00 +02:00
parent 85f9996b41
commit 999c20f3fa

View file

@ -94,8 +94,12 @@ Meteor.publish('notificationUsers', function() {
});
function activities() {
const notifications = Meteor.user().profile.notifications || [];
return Activities.find({
_id: { $in: notifications.map(v => v.activity) },
});
const activityIds = Meteor.user()?.profile?.notifications?.map(v => v.activity) || [];
let ret = [];
if (activityIds.length > 0) {
ret = Activities.find({
_id: { $in: activityIds },
});
return ret;
}
}