Don't add back deleted shortcuts.
This commit is contained in:
parent
44366bd208
commit
274720f395
@ -573,6 +573,9 @@ void QuickReplyManager::on_reload_quick_reply_shortcuts(
|
|||||||
LOG(ERROR) << "Receive duplicate " << to_string(quick_reply);
|
LOG(ERROR) << "Receive duplicate " << to_string(quick_reply);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (deleted_shortcut_ids_.count(quick_reply->shortcut_id_)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
added_shortcut_ids.insert(quick_reply->shortcut_id_);
|
added_shortcut_ids.insert(quick_reply->shortcut_id_);
|
||||||
added_shortcut_names.insert(quick_reply->shortcut_);
|
added_shortcut_names.insert(quick_reply->shortcut_);
|
||||||
|
|
||||||
@ -590,6 +593,7 @@ void QuickReplyManager::on_reload_quick_reply_shortcuts(
|
|||||||
if (message->shortcut_id != quick_reply->shortcut_id_) {
|
if (message->shortcut_id != quick_reply->shortcut_id_) {
|
||||||
LOG(ERROR) << "Receive message from shortcut " << message->shortcut_id << " instead of "
|
LOG(ERROR) << "Receive message from shortcut " << message->shortcut_id << " instead of "
|
||||||
<< quick_reply->shortcut_id_;
|
<< quick_reply->shortcut_id_;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto shortcut = td::make_unique<Shortcut>();
|
auto shortcut = td::make_unique<Shortcut>();
|
||||||
@ -688,6 +692,7 @@ void QuickReplyManager::delete_quick_reply_shortcut(const string &name, Promise<
|
|||||||
auto shortcut_id = s->shortcut_id_;
|
auto shortcut_id = s->shortcut_id_;
|
||||||
td::remove_if(shortcuts_.shortcuts_,
|
td::remove_if(shortcuts_.shortcuts_,
|
||||||
[shortcut_id](const unique_ptr<Shortcut> &shortcut) { return shortcut->shortcut_id_ == shortcut_id; });
|
[shortcut_id](const unique_ptr<Shortcut> &shortcut) { return shortcut->shortcut_id_ == shortcut_id; });
|
||||||
|
deleted_shortcut_ids_.insert(shortcut_id);
|
||||||
|
|
||||||
td_->create_handler<DeleteQuickReplyShortcutQuery>(std::move(promise))->send(shortcut_id);
|
td_->create_handler<DeleteQuickReplyShortcutQuery>(std::move(promise))->send(shortcut_id);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
|
#include "td/utils/FlatHashSet.h"
|
||||||
|
#include "td/utils/Promise.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -196,6 +198,8 @@ class QuickReplyManager final : public Actor {
|
|||||||
|
|
||||||
Shortcuts shortcuts_;
|
Shortcuts shortcuts_;
|
||||||
|
|
||||||
|
FlatHashSet<int32> deleted_shortcut_ids_;
|
||||||
|
|
||||||
Td *td_;
|
Td *td_;
|
||||||
ActorShared<> parent_;
|
ActorShared<> parent_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user