| 785 | } |
| 786 | |
| 787 | void RepliesList::setInboxReadTill( |
| 788 | MsgId readTillId, |
| 789 | std::optional<int> unreadCount) { |
| 790 | const auto newReadTillId = std::max(readTillId.bare, int64(1)); |
| 791 | const auto ignore = (newReadTillId < _inboxReadTillId); |
| 792 | if (ignore) { |
| 793 | return; |
| 794 | } |
| 795 | const auto changed = (newReadTillId > _inboxReadTillId); |
| 796 | if (changed) { |
| 797 | _inboxReadTillId = newReadTillId; |
| 798 | } |
| 799 | if (_skippedAfter == 0 |
| 800 | && !_list.empty() |
| 801 | && _inboxReadTillId >= _list.front()) { |
| 802 | unreadCount = 0; |
| 803 | } |
| 804 | const auto wasUnreadCount = _unreadCount; |
| 805 | if (_unreadCount.current() != unreadCount |
| 806 | && (changed || unreadCount.has_value())) { |
| 807 | setUnreadCount(unreadCount); |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | MsgId RepliesList::inboxReadTillId() const { |
| 812 | return _inboxReadTillId; |
no test coverage detected