Removed MTP* from PrePasswordErrorBox.

This commit is contained in:
23rd 2021-11-26 07:38:00 +03:00 committed by John Preston
parent 0c3b289af9
commit 287a35d208
5 changed files with 12 additions and 20 deletions

View File

@ -172,7 +172,7 @@ void SendBotCallbackDataWithPassword(
api->cloudPassword().reload(); api->cloudPassword().reload();
SendBotCallbackData(item, row, column, MTP_inputCheckPasswordEmpty(), [=](const MTP::Error &error) { SendBotCallbackData(item, row, column, MTP_inputCheckPasswordEmpty(), [=](const MTP::Error &error) {
auto box = PrePasswordErrorBox( auto box = PrePasswordErrorBox(
error, error.type(),
session, session,
tr::lng_bots_password_confirm_check_about( tr::lng_bots_password_confirm_check_about(
tr::now, tr::now,

View File

@ -1438,15 +1438,14 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
} }
[[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox( [[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox(
const MTP::Error &error, const QString &error,
not_null<Main::Session*> session, not_null<Main::Session*> session,
TextWithEntities &&about) { TextWithEntities &&about) {
const auto type = [&] { const auto type = [&] {
const auto &type = error.type(); if (error == u"PASSWORD_MISSING"_q) {
if (type == qstr("PASSWORD_MISSING")) {
return PasswordErrorType::NoPassword; return PasswordErrorType::NoPassword;
} else if (type.startsWith(qstr("PASSWORD_TOO_FRESH_")) } else if (error.startsWith(u"PASSWORD_TOO_FRESH_"_q)
|| type.startsWith(qstr("SESSION_TOO_FRESH_"))) { || error.startsWith(u"SESSION_TOO_FRESH_"_q)) {
return PasswordErrorType::Later; return PasswordErrorType::Later;
} }
return PasswordErrorType::None; return PasswordErrorType::None;

View File

@ -244,6 +244,6 @@ struct RecoveryEmailValidation {
const QString &pattern); const QString &pattern);
[[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox( [[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox(
const MTP::Error &error, const QString &error,
not_null<Main::Session*> session, not_null<Main::Session*> session,
TextWithEntities &&about); TextWithEntities &&about);

View File

@ -451,15 +451,12 @@ void EditAdminBox::transferOwnership() {
MTP_inputCheckPasswordEmpty() MTP_inputCheckPasswordEmpty()
)).fail([=](const MTP::Error &error) { )).fail([=](const MTP::Error &error) {
_checkTransferRequestId = 0; _checkTransferRequestId = 0;
if (!handleTransferPasswordError(error)) { if (!handleTransferPasswordError(error.type())) {
const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>(); const auto callback = crl::guard(this, [=](Fn<void()> &&close) {
const auto callback = crl::guard(this, [=] {
transferOwnershipChecked(); transferOwnershipChecked();
if (*box) { close();
(*box)->closeBox();
}
}); });
*box = getDelegate()->show(Box<Ui::ConfirmBox>( getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_rights_transfer_about( tr::lng_rights_transfer_about(
tr::now, tr::now,
lt_group, lt_group,
@ -473,7 +470,7 @@ void EditAdminBox::transferOwnership() {
}).send(); }).send();
} }
bool EditAdminBox::handleTransferPasswordError(const MTP::Error &error) { bool EditAdminBox::handleTransferPasswordError(const QString &error) {
const auto session = &user()->session(); const auto session = &user()->session();
auto about = tr::lng_rights_transfer_check_about( auto about = tr::lng_rights_transfer_check_about(
tr::now, tr::now,

View File

@ -11,10 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unique_qptr.h" #include "base/unique_qptr.h"
#include "data/data_chat_participant_status.h" #include "data/data_chat_participant_status.h"
namespace MTP {
class Error;
} // namespace MTP
namespace Ui { namespace Ui {
class FlatLabel; class FlatLabel;
class LinkButton; class LinkButton;
@ -94,7 +90,7 @@ private:
not_null<Ui::InputField*> addRankInput(); not_null<Ui::InputField*> addRankInput();
void transferOwnership(); void transferOwnership();
void transferOwnershipChecked(); void transferOwnershipChecked();
bool handleTransferPasswordError(const MTP::Error &error); bool handleTransferPasswordError(const QString &error);
void requestTransferPassword(not_null<ChannelData*> channel); void requestTransferPassword(not_null<ChannelData*> channel);
void sendTransferRequestFrom( void sendTransferRequestFrom(
QPointer<PasscodeBox> box, QPointer<PasscodeBox> box,