From 1df688cf7add1898e7274818f4106907337e078f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 3 Jul 2019 15:22:46 +0100 Subject: [PATCH] Treat rooms with pending events as read This changes the room unread logic to mark any room with pending events as read, under the assumption that you are active in the room. This also ensures that local echoes of pending events do not cause rooms to temporarily appear unread. Fixes https://github.com/vector-im/riot-web/issues/9952 --- src/Unread.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Unread.js b/src/Unread.js index d142b939a06..28f42de9c52 100644 --- a/src/Unread.js +++ b/src/Unread.js @@ -42,6 +42,14 @@ module.exports = { doesRoomHaveUnreadMessages: function(room) { const myUserId = MatrixClientPeg.get().credentials.userId; + // If the room has pending events, assume that means you are active in + // the room, and so it should be treated as read. This also ensures that + // local echoes of pending events do not cause rooms to temporarily + // appear unread as in https://github.com/vector-im/riot-web/issues/9952. + if (room.getPendingEvents().length > 0) { + return false; + } + // as we don't send RRs for our own messages, make sure we special case that // if *we* sent the last message into the room, we consider it not unread! // Should fix: https://github.com/vector-im/riot-web/issues/3263