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();
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,

View File

@ -1438,15 +1438,14 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
}
[[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox(
const MTP::Error &error,
const QString &error,
not_null<Main::Session*> 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;

View File

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

View File

@ -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<QPointer<Ui::ConfirmBox>>();
const auto callback = crl::guard(this, [=] {
if (!handleTransferPasswordError(error.type())) {
const auto callback = crl::guard(this, [=](Fn<void()> &&close) {
transferOwnershipChecked();
if (*box) {
(*box)->closeBox();
}
close();
});
*box = getDelegate()->show(Box<Ui::ConfirmBox>(
getDelegate()->show(Box<Ui::ConfirmBox>(
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,

View File

@ -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<Ui::InputField*> addRankInput();
void transferOwnership();
void transferOwnershipChecked();
bool handleTransferPasswordError(const MTP::Error &error);
bool handleTransferPasswordError(const QString &error);
void requestTransferPassword(not_null<ChannelData*> channel);
void sendTransferRequestFrom(
QPointer<PasscodeBox> box,