fix: Check if user is found before looking up role (#21490)

This commit is contained in:
Anton Georgiev 2024-10-22 10:18:49 -04:00 committed by GitHub
parent 52795280e2
commit fa7a92f5fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,7 +172,7 @@ function notifications() {
break;
case 'NotifyRoleInMeeting': {
const user = Users.findOne({ userId, meetingId }, { fields: { role: 1, userId: 1 } });
if (notification.meetingId === meetingId && notification.role === user.role) this.added('notifications', Random.id(), notification);
if (user && notification.meetingId === meetingId && notification.role === user.role) this.added('notifications', Random.id(), notification);
break;
}
default: Logger.warn(`wrong type: ${notification.type} userId: ${userId}`);