Reget message from server after DATA_INVALID error.
GitOrigin-RevId: 776fbc4d6290b2fe055c66654d0ab0ba4d649fb8
This commit is contained in:
parent
4d5fb2902c
commit
d602c3fa1f
@ -31,6 +31,7 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
int64 result_id_;
|
||||
DialogId dialog_id_;
|
||||
MessageId message_id_;
|
||||
|
||||
public:
|
||||
explicit GetBotCallbackAnswerQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
@ -40,6 +41,7 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
|
||||
int64 result_id) {
|
||||
result_id_ = result_id;
|
||||
dialog_id_ = dialog_id;
|
||||
message_id_ = message_id;
|
||||
|
||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
||||
CHECK(input_peer != nullptr);
|
||||
@ -76,6 +78,10 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void on_error(uint64 id, Status status) override {
|
||||
if (status.message() == "DATA_INVALID") {
|
||||
td->messages_manager_->get_messages_from_server(vector<FullMessageId>{FullMessageId{dialog_id_, message_id_}},
|
||||
Auto());
|
||||
}
|
||||
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetBotCallbackAnswerQuery");
|
||||
td->callback_queries_manager_->on_get_callback_query_answer(result_id_, nullptr);
|
||||
promise_.set_error(std::move(status));
|
||||
@ -226,6 +232,7 @@ int64 CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
|
||||
}
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
td_->messages_manager_->have_dialog_force(dialog_id);
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
promise.set_error(Status::Error(5, "Can't access the chat"));
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user