mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed display tags with NoRead flag while history has fake unread state.
This commit is contained in:
parent
5362d54ab6
commit
d5dbbd566f
4 changed files with 37 additions and 3 deletions
|
@ -283,7 +283,9 @@ const base::flat_set<not_null<History*>> &ChatFilter::never() const {
|
|||
return _never;
|
||||
}
|
||||
|
||||
bool ChatFilter::contains(not_null<History*> history) const {
|
||||
bool ChatFilter::contains(
|
||||
not_null<History*> history,
|
||||
bool ignoreFakeUnread) const {
|
||||
const auto flag = [&] {
|
||||
const auto peer = history->peer;
|
||||
if (const auto user = peer->asUser()) {
|
||||
|
@ -320,7 +322,7 @@ bool ChatFilter::contains(not_null<History*> history) const {
|
|||
&& (!(_flags & Flag::NoRead)
|
||||
|| state.unread
|
||||
|| state.mention
|
||||
|| history->fakeUnreadWhileOpened())
|
||||
|| (!ignoreFakeUnread && history->fakeUnreadWhileOpened()))
|
||||
&& (!(_flags & Flag::NoArchived)
|
||||
|| (history->folderKnown() && !history->folder())))
|
||||
|| _always.contains(history);
|
||||
|
|
|
@ -81,7 +81,9 @@ public:
|
|||
[[nodiscard]] const std::vector<not_null<History*>> &pinned() const;
|
||||
[[nodiscard]] const base::flat_set<not_null<History*>> &never() const;
|
||||
|
||||
[[nodiscard]] bool contains(not_null<History*> history) const;
|
||||
[[nodiscard]] bool contains(
|
||||
not_null<History*> history,
|
||||
bool ignoreFakeUnread = false) const;
|
||||
|
||||
private:
|
||||
FilterId _id = 0;
|
||||
|
|
|
@ -254,7 +254,31 @@ void Entry::notifyUnreadStateChange(const UnreadState &wasState) {
|
|||
return state.messages || state.marks || state.mentions;
|
||||
};
|
||||
if (isForFilters(wasState) != isForFilters(nowState)) {
|
||||
const auto wasTags = _tagColors.size();
|
||||
owner().chatsFilters().refreshHistory(history);
|
||||
|
||||
// Hack for History::fakeUnreadWhileOpened().
|
||||
if (!isForFilters(nowState)
|
||||
&& (wasTags > 0)
|
||||
&& (wasTags == _tagColors.size())) {
|
||||
auto updateRequested = false;
|
||||
for (const auto &filter : filters.list()) {
|
||||
if (!(filter.flags() & Data::ChatFilter::Flag::NoRead)
|
||||
|| !_chatListLinks.contains(filter.id())
|
||||
|| filter.contains(history, true)) {
|
||||
continue;
|
||||
}
|
||||
const auto wasTagsCount = _tagColors.size();
|
||||
setColorIndexForFilterId(filter.id(), std::nullopt);
|
||||
updateRequested |= (wasTagsCount != _tagColors.size());
|
||||
}
|
||||
if (updateRequested) {
|
||||
updateChatListEntryHeight();
|
||||
session().changes().peerUpdated(
|
||||
history->peer,
|
||||
Data::PeerUpdate::Flag::Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateChatListEntryPostponed();
|
||||
|
|
|
@ -803,6 +803,12 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
|| (filter.id() == context.filter)) {
|
||||
continue;
|
||||
}
|
||||
if (active
|
||||
&& (filter.flags() & Data::ChatFilter::Flag::NoRead)
|
||||
&& !filter.contains(key.history(), true)) {
|
||||
// Hack for History::fakeUnreadWhileOpened().
|
||||
continue;
|
||||
}
|
||||
if (const auto tag = cacheChatsFilterTag(filter.id(), 0, a)) {
|
||||
if (more) {
|
||||
more++;
|
||||
|
|
Loading…
Add table
Reference in a new issue