[FIX] Update last open on message stream received (#1240)

This commit is contained in:
Diego Mello 2019-09-26 13:54:24 -03:00 committed by GitHub
parent dc08dec572
commit a1297d0e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -88,6 +88,7 @@ export default function subscribeRoom({ rid }) {
const handleMessageReceived = protectedFunction((ddpMessage) => { const handleMessageReceived = protectedFunction((ddpMessage) => {
const message = buildMessage(EJSON.fromJSONValue(ddpMessage.fields.args[0])); const message = buildMessage(EJSON.fromJSONValue(ddpMessage.fields.args[0]));
const lastOpen = new Date();
if (rid !== message.rid) { if (rid !== message.rid) {
return; return;
} }
@ -163,7 +164,7 @@ export default function subscribeRoom({ rid }) {
try { try {
await subCollection.find(rid); await subCollection.find(rid);
this.readMessages(rid); this.readMessages(rid, lastOpen);
} catch (e) { } catch (e) {
console.log('Subscription not found. We probably subscribed to a not joined channel. No need to mark as read.'); console.log('Subscription not found. We probably subscribed to a not joined channel. No need to mark as read.');
} }