diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index ff5209a10f..5c463ab441 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -172,7 +172,7 @@ void SendBotCallbackDataWithPassword( api->cloudPassword().reload(); SendBotCallbackData(item, row, column, MTP_inputCheckPasswordEmpty(), [=](const MTP::Error &error) { auto box = PrePasswordErrorBox( - error, + error.type(), session, tr::lng_bots_password_confirm_check_about( tr::now, diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 4dde9db8a8..cf39fe39b8 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -1438,15 +1438,14 @@ RecoveryEmailValidation ConfirmRecoveryEmail( } [[nodiscard]] object_ptr PrePasswordErrorBox( - const MTP::Error &error, + const QString &error, not_null session, TextWithEntities &&about) { const auto type = [&] { - const auto &type = error.type(); - if (type == qstr("PASSWORD_MISSING")) { + if (error == u"PASSWORD_MISSING"_q) { return PasswordErrorType::NoPassword; - } else if (type.startsWith(qstr("PASSWORD_TOO_FRESH_")) - || type.startsWith(qstr("SESSION_TOO_FRESH_"))) { + } else if (error.startsWith(u"PASSWORD_TOO_FRESH_"_q) + || error.startsWith(u"SESSION_TOO_FRESH_"_q)) { return PasswordErrorType::Later; } return PasswordErrorType::None; diff --git a/Telegram/SourceFiles/boxes/passcode_box.h b/Telegram/SourceFiles/boxes/passcode_box.h index 40683a17d5..4ce6f39345 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.h +++ b/Telegram/SourceFiles/boxes/passcode_box.h @@ -244,6 +244,6 @@ struct RecoveryEmailValidation { const QString &pattern); [[nodiscard]] object_ptr PrePasswordErrorBox( - const MTP::Error &error, + const QString &error, not_null session, TextWithEntities &&about); diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index e497a625c9..c59f8ed59b 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -451,15 +451,12 @@ void EditAdminBox::transferOwnership() { MTP_inputCheckPasswordEmpty() )).fail([=](const MTP::Error &error) { _checkTransferRequestId = 0; - if (!handleTransferPasswordError(error)) { - const auto box = std::make_shared>(); - const auto callback = crl::guard(this, [=] { + if (!handleTransferPasswordError(error.type())) { + const auto callback = crl::guard(this, [=](Fn &&close) { transferOwnershipChecked(); - if (*box) { - (*box)->closeBox(); - } + close(); }); - *box = getDelegate()->show(Box( + getDelegate()->show(Box( tr::lng_rights_transfer_about( tr::now, lt_group, @@ -473,7 +470,7 @@ void EditAdminBox::transferOwnership() { }).send(); } -bool EditAdminBox::handleTransferPasswordError(const MTP::Error &error) { +bool EditAdminBox::handleTransferPasswordError(const QString &error) { const auto session = &user()->session(); auto about = tr::lng_rights_transfer_check_about( tr::now, diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.h b/Telegram/SourceFiles/boxes/peers/edit_participant_box.h index e9327ca85d..54f83210f1 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.h @@ -11,10 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unique_qptr.h" #include "data/data_chat_participant_status.h" -namespace MTP { -class Error; -} // namespace MTP - namespace Ui { class FlatLabel; class LinkButton; @@ -94,7 +90,7 @@ private: not_null addRankInput(); void transferOwnership(); void transferOwnershipChecked(); - bool handleTransferPasswordError(const MTP::Error &error); + bool handleTransferPasswordError(const QString &error); void requestTransferPassword(not_null channel); void sendTransferRequestFrom( QPointer box,