Skip to content

Commit

Permalink
Merge pull request #10061 from RocketChat/fix-read-receipt-error-on-e…
Browse files Browse the repository at this point in the history
…diting-message

[FIX] Message editing is crashing the server when read receipts are enabled
  • Loading branch information
rodrigok authored Mar 8, 2018
2 parents 37a8461 + f3f16de commit bdad666
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions imports/message-read-receipt/server/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit bdad666

Please sign in to comment.