message: fix one major cause of stuck unread notifications
diff: @@ -37,7 +37,26 @@ module.exports = {
  },
  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
  // 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
  