Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Treat rooms with pending events as read
Browse files Browse the repository at this point in the history
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 element-hq/element-web#9952
  • Loading branch information
jryans committed Jul 3, 2019
1 parent 5e4f37b commit 1df688c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Unread.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1df688c

Please sign in to comment.