mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added ability to check if peer can be added to specific filter.
This commit is contained in:
@@ -216,6 +216,17 @@ bool ChooseFilterValidator::canAdd() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChooseFilterValidator::canAdd(FilterId filterId) const {
|
||||
Expects(filterId != 0);
|
||||
|
||||
const auto list = _history->owner().chatsFilters().list();
|
||||
const auto i = ranges::find(list, filterId, &Data::ChatFilter::id);
|
||||
if (i != end(list)) {
|
||||
return !i->contains(_history);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChooseFilterValidator::canRemove(FilterId filterId) const {
|
||||
Expects(filterId != 0);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
};
|
||||
|
||||
[[nodiscard]] bool canAdd() const;
|
||||
[[nodiscard]] bool canAdd(FilterId filterId) const;
|
||||
[[nodiscard]] bool canRemove(FilterId filterId) const;
|
||||
[[nodiscard]] LimitData limitReached(
|
||||
FilterId filterId,
|
||||
|
||||
Reference in New Issue
Block a user