Merge pull request #1147 from matrix-org/matthew/stuck-unread
fix one major cause of stuck unread notifications
This commit is contained in:
commit
f9b37208a3
1 changed files with 20 additions and 1 deletions
|
@ -37,7 +37,26 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
doesRoomHaveUnreadMessages: function(room) {
|
doesRoomHaveUnreadMessages: function(room) {
|
||||||
var readUpToId = room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId);
|
var myUserId = MatrixClientPeg.get().credentials.userId;
|
||||||
|
|
||||||
|
// get the most recent read receipt sent by our account.
|
||||||
|
// N.B. this is NOT a read marker (RM, aka "read up to marker"),
|
||||||
|
// despite the name of the method :((
|
||||||
|
var readUpToId = room.getEventReadUpTo(myUserId);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// https://github.com/vector-im/riot-web/issues/2427
|
||||||
|
// ...and possibly some of the others at
|
||||||
|
// https://github.com/vector-im/riot-web/issues/3363
|
||||||
|
if (room.timeline.length &&
|
||||||
|
room.timeline[room.timeline.length - 1].sender &&
|
||||||
|
room.timeline[room.timeline.length - 1].sender.userId === myUserId)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// this just looks at whatever history we have, which if we've only just started
|
// this just looks at whatever history we have, which if we've only just started
|
||||||
// up probably won't be very much, so if the last couple of events are ones that
|
// up probably won't be very much, so if the last couple of events are ones that
|
||||||
// don't count, we don't know if there are any events that do count between where
|
// don't count, we don't know if there are any events that do count between where
|
||||||
|
|
Loading…
Reference in a new issue