mirror of https://github.com/procxx/kepka.git
Leave unread chats in filter until closed.
This commit is contained in:
parent
1be6d968e0
commit
3ac33e4c1c
|
@ -199,7 +199,8 @@ bool ChatFilter::contains(not_null<History*> history) const {
|
|||
&& (!(_flags & Flag::NoRead)
|
||||
|| history->unreadCount()
|
||||
|| history->unreadMark()
|
||||
|| history->hasUnreadMentions())
|
||||
|| history->hasUnreadMentions()
|
||||
|| history->fakeUnreadWhileOpened())
|
||||
&& (!(_flags & Flag::NoArchived)
|
||||
|| (history->folderKnown() && !history->folder())))
|
||||
|| _always.contains(history);
|
||||
|
|
|
@ -1837,6 +1837,23 @@ bool History::unreadMark() const {
|
|||
return _unreadMark;
|
||||
}
|
||||
|
||||
void History::setFakeUnreadWhileOpened(bool enabled) {
|
||||
if (_fakeUnreadWhileOpened == enabled
|
||||
|| (enabled
|
||||
&& (!inChatList()
|
||||
|| (!unreadCount()
|
||||
&& !unreadMark()
|
||||
&& !hasUnreadMentions())))) {
|
||||
return;
|
||||
}
|
||||
_fakeUnreadWhileOpened = enabled;
|
||||
owner().chatsFilters().refreshHistory(this);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool History::fakeUnreadWhileOpened() const {
|
||||
return _fakeUnreadWhileOpened;
|
||||
}
|
||||
|
||||
bool History::mute() const {
|
||||
return _mute;
|
||||
}
|
||||
|
|
|
@ -202,6 +202,8 @@ public:
|
|||
void setUnreadCount(int newUnreadCount);
|
||||
void setUnreadMark(bool unread);
|
||||
[[nodiscard]] bool unreadMark() const;
|
||||
void setFakeUnreadWhileOpened(bool enabled);
|
||||
[[nodiscard]] bool fakeUnreadWhileOpened() const;
|
||||
[[nodiscard]] int unreadCountForBadge() const; // unreadCount || unreadMark ? 1 : 0.
|
||||
[[nodiscard]] bool mute() const;
|
||||
bool changeMute(bool newMute);
|
||||
|
@ -540,6 +542,7 @@ private:
|
|||
std::optional<HistoryItem*> _chatListMessage;
|
||||
|
||||
bool _unreadMark = false;
|
||||
bool _fakeUnreadWhileOpened = false;
|
||||
|
||||
// A pointer to the block that is currently being built.
|
||||
// We hold this pointer so we can destroy it while building
|
||||
|
|
|
@ -1816,6 +1816,7 @@ void HistoryWidget::showHistory(
|
|||
&& (!_history->loadedAtTop() || !_migrated->loadedAtBottom())) {
|
||||
_migrated->clear(History::ClearType::Unload);
|
||||
}
|
||||
_history->setFakeUnreadWhileOpened(true);
|
||||
|
||||
_topBar->setActiveChat(
|
||||
_history,
|
||||
|
|
|
@ -257,7 +257,13 @@ const rpl::variable<Data::Folder*> &SessionController::openedFolder() const {
|
|||
}
|
||||
|
||||
void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
|
||||
if (const auto history = _activeChatEntry.current().key.history()) {
|
||||
history->setFakeUnreadWhileOpened(false);
|
||||
}
|
||||
_activeChatEntry = row;
|
||||
if (const auto history = row.key.history()) {
|
||||
history->setFakeUnreadWhileOpened(true);
|
||||
}
|
||||
if (session().supportMode()) {
|
||||
pushToChatEntryHistory(row);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue