[FIX] Omnichannel - Fix issue with modals on room preview mode. (#22541)

* Await error on main thread so meteor can handle it

* Fix an issue where clicking esc would trigger a room read on unsubscribed rooms

Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com>
pull/22580/head
Kevin Aleman 5 years ago committed by GitHub
parent f823590c5e
commit 642666cd78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/ui-utils/client/lib/readMessages.js
  2. 2
      server/methods/readMessages.js

@ -31,7 +31,6 @@ export const readMessage = new class extends Emitter {
return;
}
const subscription = ChatSubscription.findOne({ rid });
if (subscription == null) {
this.log('readMessage -> readNow canceled, no subscription found for rid:', rid);
@ -71,6 +70,13 @@ export const readMessage = new class extends Emitter {
this.log('readMessage -> readNow canceled, no rid informed');
return;
}
const subscription = ChatSubscription.findOne({ rid });
if (subscription == null) {
this.log('readMessage -> readNow canceled, no subscription found for rid:', rid);
return;
}
return Meteor.call('readMessages', rid, () => {
RoomHistoryManager.getRoom(rid).unreadNotLoaded.set(0);
return this.emit(rid);

@ -22,6 +22,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'readMessages' });
}
markRoomAsRead(rid, userId);
Promise.await(markRoomAsRead(rid, userId));
},
});

Loading…
Cancel
Save