diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index cf4c75129f..388deb7645 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1024,7 +1024,7 @@ void ApiWrap::requestFullPeer(not_null peer) { const auto requestId = [&] { const auto failHandler = [=](const MTP::Error &error) { _fullPeerRequests.remove(peer); - migrateFail(peer, error); + migrateFail(peer, error.type()); }; if (const auto user = peer->asUser()) { if (_session->supportMode()) { @@ -1191,7 +1191,7 @@ void ApiWrap::requestPeerSettings(not_null peer) { void ApiWrap::migrateChat( not_null chat, FnMut)> done, - Fn fail) { + Fn fail) { const auto callback = [&] { return MigrateCallbacks{ std::move(done), std::move(fail) }; }; @@ -1214,7 +1214,7 @@ void ApiWrap::migrateChat( chat, MTP::Error::Local( "BAD_MIGRATION", - "Chat is already deactivated")); + "Chat is already deactivated").type()); }); return; } else if (!chat->amCreator()) { @@ -1223,7 +1223,7 @@ void ApiWrap::migrateChat( chat, MTP::Error::Local( "BAD_MIGRATION", - "Current user is not the creator of that chat")); + "Current user is not the creator of that chat").type()); }); return; } @@ -1242,10 +1242,10 @@ void ApiWrap::migrateChat( } else { migrateFail( chat, - MTP::Error::Local("MIGRATION_FAIL", "No channel")); + MTP::Error::Local("MIGRATION_FAIL", "No channel").type()); } }).fail([=](const MTP::Error &error) { - migrateFail(chat, error); + migrateFail(chat, error.type()); }).send(); } @@ -1262,9 +1262,8 @@ void ApiWrap::migrateDone( } } -void ApiWrap::migrateFail(not_null peer, const MTP::Error &error) { - const auto &type = error.type(); - if (type == qstr("CHANNELS_TOO_MUCH")) { +void ApiWrap::migrateFail(not_null peer, const QString &error) { + if (error == u"CHANNELS_TOO_MUCH"_q) { Ui::show(Box(tr::lng_migrate_error(tr::now))); } if (auto handlers = _migrateCallbacks.take(peer)) { diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 80d109effb..52a3257664 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -208,7 +208,7 @@ public: void migrateChat( not_null chat, FnMut)> done, - Fn fail = nullptr); + Fn fail = nullptr); void markMediaRead(const base::flat_set> &items); void markMediaRead(not_null item); @@ -512,7 +512,7 @@ private: void migrateDone( not_null peer, not_null channel); - void migrateFail(not_null peer, const MTP::Error &error); + void migrateFail(not_null peer, const QString &error); not_null _session; @@ -613,7 +613,7 @@ private: struct MigrateCallbacks { FnMut)> done; - Fn fail; + Fn fail; }; base::flat_map< not_null, diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index c9fca8adfa..859504da42 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -242,7 +242,7 @@ void ShowEditPermissions( const auto api = &peer->session().api(); api->migrateChat(chat, [=](not_null channel) { save(channel, result); - }, [=](const MTP::Error &) { + }, [=](const QString &) { *saving = false; }); }, box->lifetime());