mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed ability to remove peer from chats filter to make it empty.
This commit is contained in:
parent
b335981621
commit
aa8d543ed8
3 changed files with 15 additions and 3 deletions
|
@ -126,9 +126,7 @@ bool ChooseFilterValidator::canRemove(FilterId filterId) const {
|
|||
const auto list = _history->owner().chatsFilters().list();
|
||||
const auto i = ranges::find(list, filterId, &Data::ChatFilter::id);
|
||||
if (i != end(list)) {
|
||||
const auto &filter = *i;
|
||||
return filter.contains(_history)
|
||||
&& ((filter.always().size() > 1) || filter.flags());
|
||||
return Data::CanRemoveFromChatFilter(*i, _history);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1086,4 +1086,14 @@ void ChatFilters::checkLoadMoreChatsLists() {
|
|||
}
|
||||
}
|
||||
|
||||
bool CanRemoveFromChatFilter(
|
||||
const ChatFilter &filter,
|
||||
not_null<History*> history) {
|
||||
using Flag = ChatFilter::Flag;
|
||||
const auto flagsWithoutNoReadNoArchivedNoMuted = filter.flags()
|
||||
& ~(Flag::NoRead | Flag::NoArchived | Flag::NoMuted);
|
||||
return (filter.always().size() > 1 || flagsWithoutNoReadNoArchivedNoMuted)
|
||||
&& filter.contains(history);
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
|
|
@ -252,4 +252,8 @@ private:
|
|||
|
||||
};
|
||||
|
||||
[[nodiscard]] bool CanRemoveFromChatFilter(
|
||||
const ChatFilter &filter,
|
||||
not_null<History*> history);
|
||||
|
||||
} // namespace Data
|
||||
|
|
Loading…
Add table
Reference in a new issue