mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +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();
|
||||
} else {
|
||||
for (const auto &commands : list) {
|
||||
auto &value = operator[](commands.userId);
|
||||
changed |= commands.commands.empty()
|
||||
? remove(commands.userId)
|
||||
: !ranges::equal(value, commands.commands);
|
||||
value = commands.commands;
|
||||
if (commands.commands.empty()) {
|
||||
changed |= remove(commands.userId);
|
||||
} else {
|
||||
auto &value = operator[](commands.userId);
|
||||
const auto isEqual = ranges::equal(value, commands.commands);
|
||||
changed |= !isEqual;
|
||||
if (!isEqual) {
|
||||
value = commands.commands;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
|
|
Loading…
Add table
Reference in a new issue