[FIX] Update last open on message stream received (#1240)
This commit is contained in:
parent
dc08dec572
commit
a1297d0e6c
|
@ -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.');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue