Skip to content

Commit

Permalink
Regression: Exception on notification when addinf someone in room via…
Browse files Browse the repository at this point in the history
… mention (#14251)
  • Loading branch information
rodrigok committed Apr 25, 2019
1 parent 5dc4511 commit 5362e0e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion app/lib/server/lib/sendNotificationsOnMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import moment from 'moment';
import { hasPermission } from '../../../authorization';
import { settings } from '../../../settings';
import { callbacks } from '../../../callbacks';
import { Subscriptions } from '../../../models';
import { Subscriptions, Users } from '../../../models/server';
import { roomTypes } from '../../../utils';
import { callJoinRoom, messageContainsHighlight, parseMessageTextPerUser, replaceMentionedUsernamesWithFullNames } from '../functions/notifications';
import { sendEmail, shouldNotifyEmail } from '../functions/notifications/email';
Expand Down Expand Up @@ -36,6 +36,21 @@ export const sendNotification = async ({
return;
}

if (!subscription.receiver) {
subscription.receiver = [
Users.findOneById(subscription.u._id, {
fields: {
active: 1,
emails: 1,
language: 1,
status: 1,
statusConnection: 1,
username: 1,
},
}),
];
}

const [receiver] = subscription.receiver;

const roomType = room.t;
Expand Down

0 comments on commit 5362e0e

Please sign in to comment.