diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-01-08 14:09:17 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-01-08 14:09:17 +0900 |
commit | fb4127da9db32e5e18b14beaaabbee7adf9cc334 (patch) | |
tree | c14ba3abd15c380dd6430240dba46c615fc5eee8 | |
parent | 0e9c56561888cbd786d099bc7d004223e7406e6a (diff) | |
download | libquotient-fb4127da9db32e5e18b14beaaabbee7adf9cc334.tar.gz libquotient-fb4127da9db32e5e18b14beaaabbee7adf9cc334.zip |
Simplified Room::Private::readMarker() code
-rw-r--r-- | room.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -252,9 +252,10 @@ bool Room::hasUnreadMessages() Room::Timeline::const_iterator Room::Private::readMarker(const User* user) const { - return lastReadEventIds.contains(user) ? - std::next(eventsIndex.value(lastReadEventIds.value(user))) : - timeline.begin(); + auto lastReadId = lastReadEventIds.value(user); + return lastReadId.isEmpty() ? + eventsIndex.value(lastReadId) + 1 : + timeline.begin(); } QString Room::readMarkerEventId() const |