mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix bug in ChatBotCommands::update when commands empty (#28631)
This commit is contained in:
parent
7e2e510d8a
commit
074bb1e66e
1 changed files with 10 additions and 5 deletions
|
@ -17,11 +17,16 @@ ChatBotCommands::Changed ChatBotCommands::update(
|
||||||
clear();
|
clear();
|
||||||
} else {
|
} else {
|
||||||
for (const auto &commands : list) {
|
for (const auto &commands : list) {
|
||||||
auto &value = operator[](commands.userId);
|
if (commands.commands.empty()) {
|
||||||
changed |= commands.commands.empty()
|
changed |= remove(commands.userId);
|
||||||
? remove(commands.userId)
|
} else {
|
||||||
: !ranges::equal(value, commands.commands);
|
auto &value = operator[](commands.userId);
|
||||||
value = commands.commands;
|
const auto isEqual = ranges::equal(value, commands.commands);
|
||||||
|
changed |= !isEqual;
|
||||||
|
if (!isEqual) {
|
||||||
|
value = commands.commands;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
Loading…
Add table
Reference in a new issue