mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed some cases when peer may not be removed from filter from menu.
This commit is contained in:
parent
98bb520f47
commit
9edbb9762a
1 changed files with 20 additions and 20 deletions
|
@ -32,27 +32,27 @@ Data::ChatFilter ChangedFilter(
|
||||||
auto never = base::duplicate(filter.never());
|
auto never = base::duplicate(filter.never());
|
||||||
if (add) {
|
if (add) {
|
||||||
never.remove(history);
|
never.remove(history);
|
||||||
const auto result = Data::ChatFilter(
|
|
||||||
filter.id(),
|
|
||||||
filter.title(),
|
|
||||||
filter.iconEmoji(),
|
|
||||||
filter.flags(),
|
|
||||||
filter.always(),
|
|
||||||
filter.pinned(),
|
|
||||||
std::move(never));
|
|
||||||
if (result.contains(history)) {
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
never = base::duplicate(result.never());
|
|
||||||
always.insert(history);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const auto alwaysIt = always.find(history);
|
always.remove(history);
|
||||||
if (alwaysIt != end(always)) {
|
}
|
||||||
always.erase(alwaysIt);
|
const auto result = Data::ChatFilter(
|
||||||
} else {
|
filter.id(),
|
||||||
never.insert(history);
|
filter.title(),
|
||||||
}
|
filter.iconEmoji(),
|
||||||
|
filter.flags(),
|
||||||
|
std::move(always),
|
||||||
|
filter.pinned(),
|
||||||
|
std::move(never));
|
||||||
|
const auto in = result.contains(history);
|
||||||
|
if (in == add) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
always = base::duplicate(result.always());
|
||||||
|
never = base::duplicate(result.never());
|
||||||
|
if (add) {
|
||||||
|
always.insert(history);
|
||||||
|
} else {
|
||||||
|
never.insert(history);
|
||||||
}
|
}
|
||||||
return Data::ChatFilter(
|
return Data::ChatFilter(
|
||||||
filter.id(),
|
filter.id(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue