From a1297d0e6cb2e66489def200bae5e3af7e332495 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 26 Sep 2019 13:54:24 -0300 Subject: [PATCH] [FIX] Update last open on message stream received (#1240) --- app/lib/methods/subscriptions/room.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/lib/methods/subscriptions/room.js b/app/lib/methods/subscriptions/room.js index 99e55b323..bbab25b58 100644 --- a/app/lib/methods/subscriptions/room.js +++ b/app/lib/methods/subscriptions/room.js @@ -88,6 +88,7 @@ export default function subscribeRoom({ rid }) { const handleMessageReceived = protectedFunction((ddpMessage) => { const message = buildMessage(EJSON.fromJSONValue(ddpMessage.fields.args[0])); + const lastOpen = new Date(); if (rid !== message.rid) { return; } @@ -163,7 +164,7 @@ export default function subscribeRoom({ rid }) { try { await subCollection.find(rid); - this.readMessages(rid); + this.readMessages(rid, lastOpen); } catch (e) { console.log('Subscription not found. We probably subscribed to a not joined channel. No need to mark as read.'); }