mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Removed MTP::Error from migrating chat.
This commit is contained in:
parent
0dfb77435d
commit
d218b76efe
3 changed files with 12 additions and 13 deletions
|
@ -1024,7 +1024,7 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> 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<PeerData*> peer) {
|
|||
void ApiWrap::migrateChat(
|
||||
not_null<ChatData*> chat,
|
||||
FnMut<void(not_null<ChannelData*>)> done,
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
Fn<void(const QString &)> 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<PeerData*> peer, const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHANNELS_TOO_MUCH")) {
|
||||
void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
||||
if (error == u"CHANNELS_TOO_MUCH"_q) {
|
||||
Ui::show(Box<Ui::InformBox>(tr::lng_migrate_error(tr::now)));
|
||||
}
|
||||
if (auto handlers = _migrateCallbacks.take(peer)) {
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
void migrateChat(
|
||||
not_null<ChatData*> chat,
|
||||
FnMut<void(not_null<ChannelData*>)> done,
|
||||
Fn<void(const MTP::Error &)> fail = nullptr);
|
||||
Fn<void(const QString &)> fail = nullptr);
|
||||
|
||||
void markMediaRead(const base::flat_set<not_null<HistoryItem*>> &items);
|
||||
void markMediaRead(not_null<HistoryItem*> item);
|
||||
|
@ -512,7 +512,7 @@ private:
|
|||
void migrateDone(
|
||||
not_null<PeerData*> peer,
|
||||
not_null<ChannelData*> channel);
|
||||
void migrateFail(not_null<PeerData*> peer, const MTP::Error &error);
|
||||
void migrateFail(not_null<PeerData*> peer, const QString &error);
|
||||
|
||||
not_null<Main::Session*> _session;
|
||||
|
||||
|
@ -613,7 +613,7 @@ private:
|
|||
|
||||
struct MigrateCallbacks {
|
||||
FnMut<void(not_null<ChannelData*>)> done;
|
||||
Fn<void(const MTP::Error&)> fail;
|
||||
Fn<void(const QString&)> fail;
|
||||
};
|
||||
base::flat_map<
|
||||
not_null<PeerData*>,
|
||||
|
|
|
@ -242,7 +242,7 @@ void ShowEditPermissions(
|
|||
const auto api = &peer->session().api();
|
||||
api->migrateChat(chat, [=](not_null<ChannelData*> channel) {
|
||||
save(channel, result);
|
||||
}, [=](const MTP::Error &) {
|
||||
}, [=](const QString &) {
|
||||
*saving = false;
|
||||
});
|
||||
}, box->lifetime());
|
||||
|
|
Loading…
Add table
Reference in a new issue