[FIX] Auto hide room from sidebar on close (#13824)

[FIX] Auto hide Livechat room from sidebar on close
pull/13983/head^2
Kautilya Tripathi 6 years ago committed by Renato Becker
parent 59e5e92aae
commit ab3faad20f
  1. 3
      app/livechat/server/lib/Livechat.js
  2. 6
      imports/message-read-receipt/server/hooks.js

@ -314,6 +314,9 @@ export const Livechat = {
groupable: false,
};
// Retreive the closed room
room = Rooms.findOneByIdOrName(room._id);
sendMessage(user, message, room);
if (room.servedBy) {

@ -9,8 +9,10 @@ callbacks.add('afterSaveMessage', (message, room) => {
return message;
}
// set subscription as read right after message was sent
Subscriptions.setAsReadByRoomIdAndUserId(room._id, message.u._id);
if (room && !room.closedAt) {
// set subscription as read right after message was sent
Subscriptions.setAsReadByRoomIdAndUserId(room._id, message.u._id);
}
// mark message as read as well
ReadReceipt.markMessageAsReadBySender(message, room._id, message.u._id);

Loading…
Cancel
Save