Merge pull request #10061 from RocketChat/fix-read-receipt-error-on-editing-message

[FIX] Message editing is crashing the server when read receipts are enabled
pull/10087/head
Rodrigo Nascimento 7 years ago
parent 3f77dcb499
commit 5857f6f5c0
No known key found for this signature in database
GPG Key ID: CFCE33B7B01AC335
  1. 5
      imports/message-read-receipt/server/hooks.js

@ -2,6 +2,11 @@ import { ReadReceipt } from './lib/ReadReceipt';
RocketChat.callbacks.add('afterSaveMessage', (message, room) => {
// skips this callback if the message was edited
if (message.editedAt) {
return message;
}
// set subscription as read right after message was sent
RocketChat.models.Subscriptions.setAsReadByRoomIdAndUserId(room._id, message.u._id);

Loading…
Cancel
Save