From 3647241f71849355dec72ef62214374be9cabbd4 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 26 Nov 2021 23:46:53 +0300 Subject: [PATCH] Removed unused MTP::Error from callbacks on fail. --- .../SourceFiles/api/api_attached_stickers.cpp | 2 +- .../SourceFiles/api/api_authorizations.cpp | 6 +- .../SourceFiles/api/api_blocked_peers.cpp | 6 +- .../SourceFiles/api/api_chat_participants.cpp | 10 ++-- .../SourceFiles/api/api_cloud_password.cpp | 6 +- .../SourceFiles/api/api_global_privacy.cpp | 4 +- Telegram/SourceFiles/api/api_invite_links.cpp | 15 +++-- Telegram/SourceFiles/api/api_polls.cpp | 6 +- .../SourceFiles/api/api_self_destruct.cpp | 4 +- .../SourceFiles/api/api_sensitive_content.cpp | 4 +- .../api/api_single_message_search.cpp | 6 +- Telegram/SourceFiles/api/api_updates.cpp | 4 +- Telegram/SourceFiles/api/api_user_privacy.cpp | 4 +- Telegram/SourceFiles/api/api_who_read.cpp | 2 +- Telegram/SourceFiles/apiwrap.cpp | 60 +++++++++---------- Telegram/SourceFiles/boxes/passcode_box.cpp | 12 ++-- Telegram/SourceFiles/boxes/passcode_box.h | 1 - .../boxes/peers/add_participants_box.cpp | 4 +- .../boxes/peers/edit_contact_box.cpp | 1 - .../boxes/peers/edit_participants_box.cpp | 8 +-- .../boxes/peers/edit_peer_info_box.cpp | 6 +- .../boxes/peers/edit_peer_invite_link.cpp | 2 +- .../boxes/peers/edit_peer_permissions_box.cpp | 2 +- .../boxes/peers/edit_peer_requests_box.cpp | 2 +- .../SourceFiles/boxes/pin_messages_box.cpp | 2 +- .../SourceFiles/boxes/sticker_set_box.cpp | 6 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 2 +- Telegram/SourceFiles/boxes/url_auth_box.cpp | 8 +-- .../calls/calls_box_controller.cpp | 2 +- Telegram/SourceFiles/calls/calls_call.cpp | 2 +- Telegram/SourceFiles/calls/calls_instance.cpp | 4 +- .../calls/group/calls_choose_join_as.cpp | 2 +- .../calls/group/calls_group_call.cpp | 7 +-- .../chat_helpers/emoji_keywords.cpp | 4 +- .../chat_helpers/gifs_list_widget.cpp | 2 +- .../chat_helpers/send_context_menu.cpp | 2 +- .../chat_helpers/stickers_dice_pack.cpp | 2 +- .../chat_helpers/stickers_emoji_pack.cpp | 2 +- .../chat_helpers/stickers_list_widget.cpp | 5 +- .../SourceFiles/data/data_chat_filters.cpp | 6 +- .../SourceFiles/data/data_cloud_themes.cpp | 6 +- Telegram/SourceFiles/data/data_group_call.cpp | 6 +- Telegram/SourceFiles/data/data_histories.cpp | 31 ++++------ .../SourceFiles/data/data_replies_list.cpp | 6 +- .../data/data_scheduled_messages.cpp | 2 +- .../data/data_search_controller.cpp | 2 +- .../data/data_sponsored_messages.cpp | 4 +- .../data/stickers/data_stickers.cpp | 2 +- .../admin_log/history_admin_log_inner.cpp | 4 +- .../SourceFiles/history/history_message.cpp | 2 +- .../view/controls/history_view_ttl_button.cpp | 2 +- .../view/history_view_context_menu.cpp | 2 - .../polls/info_polls_results_inner_widget.cpp | 2 +- .../inline_bots/inline_results_widget.cpp | 2 +- Telegram/SourceFiles/intro/intro_step.cpp | 2 +- .../SourceFiles/lang/lang_cloud_manager.cpp | 8 +-- Telegram/SourceFiles/main/main_app_config.cpp | 2 +- .../passport/passport_form_controller.cpp | 4 +- .../SourceFiles/settings/settings_main.cpp | 2 +- .../SourceFiles/support/support_helper.cpp | 4 +- .../window/themes/window_theme_editor_box.cpp | 2 +- .../window/window_session_controller.cpp | 8 +-- 62 files changed, 158 insertions(+), 182 deletions(-) diff --git a/Telegram/SourceFiles/api/api_attached_stickers.cpp b/Telegram/SourceFiles/api/api_attached_stickers.cpp index 9a7e9d495..1aa455963 100644 --- a/Telegram/SourceFiles/api/api_attached_stickers.cpp +++ b/Telegram/SourceFiles/api/api_attached_stickers.cpp @@ -59,7 +59,7 @@ void AttachedStickers::request( strongController->show( Box(strongController, setId), Ui::LayerOption::KeepOther); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; if (const auto strongController = weak.get()) { strongController->show( diff --git a/Telegram/SourceFiles/api/api_authorizations.cpp b/Telegram/SourceFiles/api/api_authorizations.cpp index 050fc458b..a360d8e78 100644 --- a/Telegram/SourceFiles/api/api_authorizations.cpp +++ b/Telegram/SourceFiles/api/api_authorizations.cpp @@ -132,7 +132,7 @@ void Authorizations::reload() { }) | ranges::to; _listChanges.fire({}); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } @@ -196,7 +196,7 @@ void Authorizations::updateTTL(int days) { MTP_int(days) )).done([=](const MTPBool &result) { _ttlRequestId = 0; - }).fail([=](const MTP::Error &result) { + }).fail([=] { _ttlRequestId = 0; }).send(); _ttlDays = days; @@ -218,7 +218,7 @@ void Authorizations::toggleCallsDisabled(uint64 hash, bool disabled) { MTP_bool(disabled) )).done([=](const MTPBool &) { _toggleCallsDisabledRequests.remove(hash); - }).fail([=](const MTP::Error &) { + }).fail([=] { _toggleCallsDisabledRequests.remove(hash); }).send(); _toggleCallsDisabledRequests.emplace(hash, id); diff --git a/Telegram/SourceFiles/api/api_blocked_peers.cpp b/Telegram/SourceFiles/api/api_blocked_peers.cpp index f6edad324..56ec63062 100644 --- a/Telegram/SourceFiles/api/api_blocked_peers.cpp +++ b/Telegram/SourceFiles/api/api_blocked_peers.cpp @@ -90,7 +90,7 @@ void BlockedPeers::block(not_null peer) { ++_slice->total; _changes.fire_copy(*_slice); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _blockRequests.erase(peer); }).send(); @@ -128,7 +128,7 @@ void BlockedPeers::unblock(not_null peer, Fn onDone) { if (onDone) { onDone(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _blockRequests.erase(peer); }).send(); _blockRequests.emplace(peer, requestId); @@ -165,7 +165,7 @@ void BlockedPeers::request(int offset, Fn onDone) { )).done([=](const MTPcontacts_Blocked &result) { _requestId = 0; onDone(TLToSlice(result, _session->data())); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/api/api_chat_participants.cpp b/Telegram/SourceFiles/api/api_chat_participants.cpp index 89edb5e32..c1fbc1797 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.cpp +++ b/Telegram/SourceFiles/api/api_chat_participants.cpp @@ -387,7 +387,7 @@ void ChatParticipants::requestLast(not_null channel) { LOG(("API Error: " "channels.channelParticipantsNotModified received!")); }); - }).fail([this, channel](const MTP::Error &error) { + }).fail([this, channel] { _participantsRequests.remove(channel); }).send(); @@ -416,7 +416,7 @@ void ChatParticipants::requestBots(not_null channel) { LOG(("API Error: " "channels.channelParticipantsNotModified received!")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _botsRequests.remove(channel); }).send(); @@ -445,7 +445,7 @@ void ChatParticipants::requestAdmins(not_null channel) { LOG(("API Error: " "channels.channelParticipantsNotModified received!")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _adminsRequests.remove(channel); }).send(); @@ -638,7 +638,7 @@ void ChatParticipants::kick( _kickRequests.remove(KickRequest(channel, participant)); channel->applyEditBanned(participant, currentRights, rights); - }).fail([this, kick](const MTP::Error &error) { + }).fail([this, kick] { _kickRequests.remove(kick); }).send(); @@ -666,7 +666,7 @@ void ChatParticipants::unblock( } else { channel->updateFullForced(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _kickRequests.remove(kick); }).send(); diff --git a/Telegram/SourceFiles/api/api_cloud_password.cpp b/Telegram/SourceFiles/api/api_cloud_password.cpp index b2f36d0b9..03ca032ad 100644 --- a/Telegram/SourceFiles/api/api_cloud_password.cpp +++ b/Telegram/SourceFiles/api/api_cloud_password.cpp @@ -36,17 +36,17 @@ void CloudPassword::reload() { } _stateChanges.fire_copy(*_state); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } void CloudPassword::clearUnconfirmedPassword() { _requestId = _api.request(MTPaccount_CancelPasswordEmail( - )).done([=](const MTPBool &result) { + )).done([=] { _requestId = 0; reload(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; reload(); }).send(); diff --git a/Telegram/SourceFiles/api/api_global_privacy.cpp b/Telegram/SourceFiles/api/api_global_privacy.cpp index 3d2c1d462..c940dbe86 100644 --- a/Telegram/SourceFiles/api/api_global_privacy.cpp +++ b/Telegram/SourceFiles/api/api_global_privacy.cpp @@ -33,7 +33,7 @@ void GlobalPrivacy::reload(Fn callback) { for (const auto &callback : base::take(_callbacks)) { callback(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; for (const auto &callback : base::take(_callbacks)) { callback(); @@ -86,7 +86,7 @@ void GlobalPrivacy::update(bool archiveAndMute) { )).done([=](const MTPGlobalPrivacySettings &result) { _requestId = 0; apply(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); _archiveAndMute = archiveAndMute; diff --git a/Telegram/SourceFiles/api/api_invite_links.cpp b/Telegram/SourceFiles/api/api_invite_links.cpp index d53c3857e..8206c6bb4 100644 --- a/Telegram/SourceFiles/api/api_invite_links.cpp +++ b/Telegram/SourceFiles/api/api_invite_links.cpp @@ -128,7 +128,7 @@ void InviteLinks::performCreate( callback(link); } } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _createCallbacks.erase(peer); }).send(); } @@ -313,7 +313,7 @@ void InviteLinks::performEdit( prepend(peer, admin, data.vnew_invite()); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _editCallbacks.erase(key); }).send(); } @@ -375,7 +375,7 @@ void InviteLinks::destroy( .admin = admin, .was = key.link, }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _deleteCallbacks.erase(key); }).send(); } @@ -405,7 +405,6 @@ void InviteLinks::destroyAllRevoked( } } _allRevokedDestroyed.fire({ peer, admin }); - }).fail([=](const MTP::Error &error) { }).send(); } @@ -446,7 +445,7 @@ void InviteLinks::requestMyLinks(not_null peer) { i->second.count = std::max(slice.count, int(existing.size())); } notify(peer); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _firstSliceRequests.remove(peer); }).send(); _firstSliceRequests.emplace(peer, requestId); @@ -507,7 +506,7 @@ void InviteLinks::processRequest( done(); } } - }).fail([=](const MTP::Error &error) { + }).fail([=] { if (const auto callbacks = _processRequests.take({ peer, user })) { if (const auto &fail = callbacks->fail) { fail(); @@ -608,7 +607,7 @@ void InviteLinks::requestJoinedFirstSlice(LinkKey key) { _firstJoinedRequests.remove(key); _firstJoined[key] = ParseJoinedByLinkSlice(key.peer, result); _joinedFirstSliceLoaded.fire_copy(key); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _firstJoinedRequests.remove(key); }).send(); _firstJoinedRequests.emplace(key, requestId); @@ -771,7 +770,7 @@ void InviteLinks::requestMoreLinks( MTP_int(kPerPage) )).done([=](const MTPmessages_ExportedChatInvites &result) { done(parseSlice(peer, result)); - }).fail([=](const MTP::Error &error) { + }).fail([=] { done(Links()); }).send(); } diff --git a/Telegram/SourceFiles/api/api_polls.cpp b/Telegram/SourceFiles/api/api_polls.cpp index 80c3c55ae..7f4924a41 100644 --- a/Telegram/SourceFiles/api/api_polls.cpp +++ b/Telegram/SourceFiles/api/api_polls.cpp @@ -150,7 +150,7 @@ void Polls::sendVotes( _pollVotesRequestIds.erase(itemId); hideSending(); _session->updates().applyUpdates(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _pollVotesRequestIds.erase(itemId); hideSending(); }).send(); @@ -179,7 +179,7 @@ void Polls::close(not_null item) { )).done([=](const MTPUpdates &result) { _pollCloseRequestIds.erase(itemId); _session->updates().applyUpdates(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _pollCloseRequestIds.erase(itemId); }).send(); _pollCloseRequestIds.emplace(itemId, requestId); @@ -196,7 +196,7 @@ void Polls::reloadResults(not_null item) { )).done([=](const MTPUpdates &result) { _pollReloadRequestIds.erase(itemId); _session->updates().applyUpdates(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _pollReloadRequestIds.erase(itemId); }).send(); _pollReloadRequestIds.emplace(itemId, requestId); diff --git a/Telegram/SourceFiles/api/api_self_destruct.cpp b/Telegram/SourceFiles/api/api_self_destruct.cpp index ea7de681b..6247f3037 100644 --- a/Telegram/SourceFiles/api/api_self_destruct.cpp +++ b/Telegram/SourceFiles/api/api_self_destruct.cpp @@ -25,7 +25,7 @@ void SelfDestruct::reload() { result.match([&](const MTPDaccountDaysTTL &data) { _days = data.vdays().v; }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } @@ -42,7 +42,7 @@ void SelfDestruct::update(int days) { MTP_accountDaysTTL(MTP_int(days)) )).done([=](const MTPBool &result) { _requestId = 0; - }).fail([=](const MTP::Error &result) { + }).fail([=] { _requestId = 0; }).send(); _days = days; diff --git a/Telegram/SourceFiles/api/api_sensitive_content.cpp b/Telegram/SourceFiles/api/api_sensitive_content.cpp index a18967368..d12084dbe 100644 --- a/Telegram/SourceFiles/api/api_sensitive_content.cpp +++ b/Telegram/SourceFiles/api/api_sensitive_content.cpp @@ -36,7 +36,7 @@ void SensitiveContent::reload() { _enabled = data.is_sensitive_enabled(); _canChange = data.is_sensitive_can_change(); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } @@ -63,7 +63,7 @@ void SensitiveContent::update(bool enabled) { MTP_flags(enabled ? Flag::f_sensitive_enabled : Flag(0)) )).done([=](const MTPBool &result) { _requestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); _enabled = enabled; diff --git a/Telegram/SourceFiles/api/api_single_message_search.cpp b/Telegram/SourceFiles/api/api_single_message_search.cpp index 781a1740a..4b374f3bb 100644 --- a/Telegram/SourceFiles/api/api_single_message_search.cpp +++ b/Telegram/SourceFiles/api/api_single_message_search.cpp @@ -117,7 +117,7 @@ std::optional SingleMessageSearch::performLookupByChannel( } else { fail(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { fail(); }).send(); @@ -154,7 +154,7 @@ std::optional SingleMessageSearch::performLookupById( fail(); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { fail(); }).send(); @@ -198,7 +198,7 @@ std::optional SingleMessageSearch::performLookupByUsername( fail(); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { fail(); }).send(); diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index ffefc85de..aa764490b 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -769,7 +769,7 @@ void Updates::channelRangeDifferenceSend( )).done([=](const MTPupdates_ChannelDifference &result) { _rangeDifferenceRequests.remove(channel); channelRangeDifferenceDone(channel, range, result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _rangeDifferenceRequests.remove(channel); }).send(); _rangeDifferenceRequests.emplace(channel, requestId); @@ -921,7 +921,7 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) { MTP_bool(!isOnline) )).done([=](const MTPBool &result) { Core::App().quitPreventFinished(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { Core::App().quitPreventFinished(); }).send(); } diff --git a/Telegram/SourceFiles/api/api_user_privacy.cpp b/Telegram/SourceFiles/api/api_user_privacy.cpp index 6baf18129..7a5f01de7 100644 --- a/Telegram/SourceFiles/api/api_user_privacy.cpp +++ b/Telegram/SourceFiles/api/api_user_privacy.cpp @@ -241,7 +241,7 @@ void UserPrivacy::save( _privacySaveRequests.remove(keyTypeId); apply(keyTypeId, data.vrules(), true); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _privacySaveRequests.remove(keyTypeId); }).send(); @@ -277,7 +277,7 @@ void UserPrivacy::reload(Key key) { _session->data().processChats(data.vchats()); pushPrivacy(key, data.vrules()); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _privacyRequestIds.erase(key); }).send(); _privacyRequestIds.emplace(key, requestId); diff --git a/Telegram/SourceFiles/api/api_who_read.cpp b/Telegram/SourceFiles/api/api_who_read.cpp index d7fcbb8ff..40f659c95 100644 --- a/Telegram/SourceFiles/api/api_who_read.cpp +++ b/Telegram/SourceFiles/api/api_who_read.cpp @@ -164,7 +164,7 @@ struct State { peers.push_back(UserId(id)); } entry.list = std::move(peers); - }).fail([=](const MTP::Error &error) { + }).fail([=] { auto &entry = context->cache(item); entry.requestId = 0; if (ListUnknown(entry.list.current(), item)) { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index d5936b946..b7567a5a4 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -226,7 +226,7 @@ void ApiWrap::refreshTopPromotion() { )).done([=](const MTPhelp_PromoData &result) { _topPromotionRequestId = 0; topPromotionDone(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _topPromotionRequestId = 0; const auto now = base::unixtime::now(); const auto next = _topPromotionNextRequestTime = now @@ -276,7 +276,7 @@ void ApiWrap::requestDeepLinkInfo( if (result.type() == mtpc_help_deepLinkInfo) { callback(result.c_help_deepLinkInfo()); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _deepLinkInfoRequestId = 0; }).send(); } @@ -323,7 +323,7 @@ void ApiWrap::requestTermsUpdate() { } break; default: Unexpected("Type in requestTermsUpdate()."); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _termsUpdateRequestId = 0; _termsUpdateSendAt = crl::now() + kTermsUpdateTimeoutMin; requestTermsUpdate(); @@ -455,7 +455,7 @@ void ApiWrap::toggleHistoryArchived( if (isPinned) { _session->data().notifyPinnedDialogsOrderUpdated(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _historyArchivedRequests.remove(history); }).send(); _historyArchivedRequests.emplace(history, requestId, callback); @@ -736,7 +736,7 @@ void ApiWrap::requestContacts() { } } _session->data().contactsLoaded() = true; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _contactsRequestId = 0; }).send(); } @@ -810,7 +810,7 @@ void ApiWrap::requestMoreDialogs(Data::Folder *folder) { } requestMoreDialogsIfNeeded(); _session->data().chatsListChanged(folder); - }).fail([=](const MTP::Error &error) { + }).fail([=] { dialogsLoadState(folder)->requestId = 0; }).send(); @@ -955,7 +955,7 @@ void ApiWrap::requestPinnedDialogs(Data::Folder *folder) { _session->data().chatsListChanged(folder); _session->data().notifyPinnedDialogsOrderUpdated(); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finalize(); }).send(); } @@ -1138,7 +1138,7 @@ void ApiWrap::requestPeer(not_null peer) { } const auto requestId = [&] { - const auto failHandler = [=](const MTP::Error &error) { + const auto failHandler = [=] { _peerRequests.remove(peer); }; const auto chatHandler = [=](const MTPmessages_Chats &result) { @@ -1183,7 +1183,7 @@ void ApiWrap::requestPeerSettings(not_null peer) { peer->setSettings(data.vsettings()); _requestedPeerSettings.erase(peer); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestedPeerSettings.erase(peer); }).send(); } @@ -1437,7 +1437,7 @@ void ApiWrap::requestStickerSets() { MTP_int(0) // hash )).done([=, setId = i.key()](const MTPmessages_StickerSet &result) { gotStickerSet(setId, result); - }).fail([=, setId = i.key()](const MTP::Error &error) { + }).fail([=, setId = i.key()] { _stickerSetRequests.remove(setId); }).afterDelay(waitMs).send(); } @@ -1480,7 +1480,7 @@ void ApiWrap::saveStickerSets( MTP_vector(mtpOrder) )).done([=](const MTPBool &result) { reorderRequestId() = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { reorderRequestId() = 0; if (setsMasks) { _session->data().stickers().setLastMasksUpdate(0); @@ -1553,7 +1553,7 @@ void ApiWrap::saveStickerSets( MTP_flags(flags) )).done([=](const MTPBool &result) { finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finish(); }).send(); continue; @@ -1755,7 +1755,7 @@ void ApiWrap::leaveChannel(not_null channel) { )).done([=](const MTPUpdates &result) { _channelAmInRequests.remove(channel); applyUpdates(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _channelAmInRequests.remove(channel); }).send(); @@ -1797,7 +1797,7 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) { )).done([=](const MTPPeerNotifySettings &result) { applyNotifySettings(peer, result); _notifySettingRequests.erase(key); - }).fail([=](const MTP::Error &error) { + }).fail([=] { applyNotifySettings( peer, MTP_peerNotifySettings( @@ -1879,7 +1879,7 @@ void ApiWrap::updatePrivacyLastSeens() { } } } - }).fail([this](const MTP::Error &error) { + }).fail([this] { _contactsStatusesRequestId = 0; }).send(); } @@ -1913,7 +1913,7 @@ void ApiWrap::deleteConversation(not_null peer, bool revoke) { )).done([=](const MTPUpdates &result) { applyUpdates(result); deleteHistory(peer, false, revoke); - }).fail([=](const MTP::Error &error) { + }).fail([=] { deleteHistory(peer, false, revoke); }).send(); } else { @@ -2337,7 +2337,7 @@ void ApiWrap::requestFileReference( for (auto &handler : handlers) { handler(parsed); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { const auto i = _fileReferenceHandlers.find(origin); Assert(i != end(_fileReferenceHandlers)); auto handlers = std::move(i->second); @@ -2590,7 +2590,7 @@ void ApiWrap::requestStickers(TimeId now) { }; _stickersUpdateRequest = request(MTPmessages_GetAllStickers( MTP_long(Api::CountStickersHash(_session, true)) - )).done(done).fail([=](const MTP::Error &error) { + )).done(done).fail([=] { LOG(("App Fail: Failed to get stickers!")); done(MTP_messages_allStickersNotModified()); }).send(); @@ -2614,7 +2614,7 @@ void ApiWrap::requestMasks(TimeId now) { }; _masksUpdateRequest = request(MTPmessages_GetMaskStickers( MTP_long(Api::CountMasksHash(_session, true)) - )).done(done).fail([=](const MTP::Error &error) { + )).done(done).fail([=] { LOG(("App Fail: Failed to get masks!")); done(MTP_messages_allStickersNotModified()); }).send(); @@ -2674,7 +2674,7 @@ void ApiWrap::requestRecentStickersWithHash(uint64 hash, bool attached) { } return; default: Unexpected("Type in ApiWrap::recentStickersDone()"); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { finish(); LOG(("App Fail: Failed to get recent stickers!")); @@ -2705,7 +2705,7 @@ void ApiWrap::requestFavedStickers(TimeId now) { } return; default: Unexpected("Type in ApiWrap::favedStickersDone()"); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _session->data().stickers().setLastFavedUpdate(crl::now()); _favedStickersUpdateRequest = 0; @@ -2735,7 +2735,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) { } return; default: Unexpected("Type in ApiWrap::featuredStickersDone()"); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _session->data().stickers().setLastFeaturedUpdate(crl::now()); _featuredStickersUpdateRequest = 0; @@ -2764,7 +2764,7 @@ void ApiWrap::requestSavedGifs(TimeId now) { } return; default: Unexpected("Type in ApiWrap::savedGifsDone()"); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _session->data().stickers().setLastSavedGifsUpdate(crl::now()); _savedGifsUpdateRequest = 0; @@ -2923,7 +2923,7 @@ void ApiWrap::preloadEnoughUnreadMentions(not_null history) { auto requestId = request(MTPmessages_GetUnreadMentions(history->peer->input, MTP_int(offsetId), MTP_int(addOffset), MTP_int(limit), MTP_int(maxId), MTP_int(minId))).done([this, history](const MTPmessages_Messages &result) { _unreadMentionsRequests.remove(history); history->addUnreadMentionsSlice(result); - }).fail([this, history](const MTP::Error &error) { + }).fail([this, history] { _unreadMentionsRequests.remove(history); }).send(); _unreadMentionsRequests.emplace(history, requestId); @@ -2982,7 +2982,7 @@ void ApiWrap::requestSharedMedia( _sharedMediaRequests.remove(key); sharedMediaDone(peer, type, messageId, slice, result); finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _sharedMediaRequests.remove(key); finish(); }).send(); @@ -3031,7 +3031,7 @@ void ApiWrap::requestUserPhotos( )).done([this, user, afterId](const MTPphotos_Photos &result) { _userPhotosRequests.remove(user); userPhotosDone(user, afterId, result); - }).fail([this, user](const MTP::Error &error) { + }).fail([this, user] { _userPhotosRequests.remove(user); }).send(); _userPhotosRequests.emplace(user, requestId); @@ -3823,7 +3823,7 @@ void ApiWrap::uploadAlbumMedia( sendAlbumWithUploaded(item, groupId, media); } break; } - }).fail([=](const MTP::Error &error) { + }).fail([=] { failed(); }).send(); } @@ -4034,7 +4034,7 @@ void ApiWrap::reloadContactSignupSilent() { const auto silent = mtpIsTrue(result); _contactSignupSilent = silent; _contactSignupSilentChanges.fire_copy(silent); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _contactSignupSilentRequestId = 0; }).send(); _contactSignupSilentRequestId = requestId; @@ -4060,7 +4060,7 @@ void ApiWrap::saveContactSignupSilent(bool silent) { _contactSignupSilentRequestId = 0; _contactSignupSilent = silent; _contactSignupSilentChanges.fire_copy(silent); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _contactSignupSilentRequestId = 0; }).send(); _contactSignupSilentRequestId = requestId; @@ -4085,7 +4085,7 @@ void ApiWrap::saveSelfBio(const QString &text) { _session->data().processUser(result); _session->user()->setAbout(_bio.requestedText); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _bio.requestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index cf39fe39b..5d8ab1f28 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -478,10 +478,6 @@ void PasscodeBox::closeReplacedBy() { } } -void PasscodeBox::setPasswordFail(const MTP::Error &error) { - setPasswordFail(error.type()); -} - void PasscodeBox::setPasswordFail(const QString &type) { if (MTP::IsFloodError(type)) { closeReplacedBy(); @@ -533,7 +529,7 @@ void PasscodeBox::setPasswordFail( validateEmail(email, codeLength, newPasswordBytes); } else { - setPasswordFail(error); + setPasswordFail(error.type()); } } @@ -582,7 +578,7 @@ void PasscodeBox::validateEmail( )).done([=](const MTPBool &result) { _setRequest = 0; resent->fire(tr::lng_cloud_password_resent(tr::now)); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _setRequest = 0; errors->fire(Lang::Hard::ServerError()); }).send(); @@ -942,7 +938,7 @@ void PasscodeBox::changeCloudPassword( }); } }).fail([=](const MTP::Error &error) { - setPasswordFail(error); + setPasswordFail(error.type()); }).handleFloodErrors().send(); } @@ -1419,7 +1415,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail( )).done([=](const MTPBool &result) { *requestId = 0; resent->fire(tr::lng_cloud_password_resent(tr::now)); - }).fail([=](const MTP::Error &error) { + }).fail([=] { *requestId = 0; errors->fire(Lang::Hard::ServerError()); }).send(); diff --git a/Telegram/SourceFiles/boxes/passcode_box.h b/Telegram/SourceFiles/boxes/passcode_box.h index 4ce6f3934..4d731d749 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.h +++ b/Telegram/SourceFiles/boxes/passcode_box.h @@ -98,7 +98,6 @@ private: void recoverPasswordDone( const QByteArray &newPasswordBytes, const MTPauth_Authorization &result); - void setPasswordFail(const MTP::Error &error); void setPasswordFail(const QString &type); void setPasswordFail( const QByteArray &newPasswordBytes, diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index 01dbff4af..1c70ee885 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -490,7 +490,7 @@ void AddSpecialBoxController::loadMoreRows() { setDescriptionText(tr::lng_blocked_list_not_found(tr::now)); } delegate()->peerListRefreshRows(); - }).fail([this](const MTP::Error &error) { + }).fail([this] { _loadRequestId = 0; }).send(); } @@ -530,7 +530,7 @@ bool AddSpecialBoxController::checkInfoLoaded( Api::ChatParticipant(data.vparticipant(), channel)); }); callback(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _additional.setExternal(participant); callback(); }).send(); diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index b7c473362..96fc581b4 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -73,7 +73,6 @@ void SendRequest( lt_user, first)); } - }).fail([=](const MTP::Error &error) { }).send(); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index bc9b9508e..ad09dde7d 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -61,7 +61,7 @@ void RemoveAdmin( if (onDone) { onDone(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { if (onFail) { onFail(); } @@ -168,7 +168,7 @@ void SaveChannelRestriction( if (onDone) { onDone(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { if (onFail) { onFail(); } @@ -189,7 +189,7 @@ void SaveChatParticipantKick( if (onDone) { onDone(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { if (onFail) { onFail(); } @@ -1418,7 +1418,7 @@ void ParticipantsBoxController::loadMoreRows() { _onlineSorter->sort(); } delegate()->peerListRefreshRows(); - }).fail([this](const MTP::Error &error) { + }).fail([this] { _loadRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 98f9b4e31..84fae3ba8 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 &error) { + }, [=](const MTP::Error &) { *saving = false; }); }, box->lifetime()); @@ -685,7 +685,7 @@ void Controller::showEditLinkedChatBox() { std::move(chats), callback), Ui::LayerOption::KeepOther); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _linkedChatsRequestId = 0; }).send(); } @@ -1361,7 +1361,7 @@ void Controller::saveLinkedChat() { )).done([=](const MTPBool &result) { channel->setLinkedChat(*_savingData.linkedChat); continueSave(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { cancelSave(); }).send(); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 61b6af100..33b648a49 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -689,7 +689,7 @@ void Controller::loadMoreRows() { auto slice = Api::ParseJoinedByLinkSlice(_peer, result); _allLoaded = slice.users.empty(); appendSlice(slice); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; _allLoaded = true; }).send(); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index a83f24beb..6910a43a6 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -327,7 +327,7 @@ Fn AboutGigagroupCallback(not_null channel) { channel->session().api().applyUpdates(result); Ui::hideSettingsAndLayer(); Ui::Toast::Show(tr::lng_gigagroup_done(tr::now)); - }).fail([=](const MTP::Error &error) { + }).fail([=] { *converting = false; }).send(); }; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp index 4f60cd638..02370e74a 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp @@ -340,7 +340,7 @@ void RequestsBoxController::loadMoreRows() { refreshDescription(); } delegate()->peerListRefreshRows(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _loadRequestId = 0; _allLoaded = true; }).send(); diff --git a/Telegram/SourceFiles/boxes/pin_messages_box.cpp b/Telegram/SourceFiles/boxes/pin_messages_box.cpp index 3b9718ceb..f5c4c69a0 100644 --- a/Telegram/SourceFiles/boxes/pin_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/pin_messages_box.cpp @@ -123,7 +123,7 @@ void PinMessageBox::pinMessage() { )).done([=](const MTPUpdates &result) { _peer->session().api().applyUpdates(result); Ui::hideLayer(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { Ui::hideLayer(); }).send(); } diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 6e66ce602..2b2852381 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -371,7 +371,7 @@ StickerSetBox::Inner::Inner( MTP_int(0) // hash )).done([=](const MTPmessages_StickerSet &result) { gotSet(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _loaded = true; _errors.fire(Error::NotFound); }).send(); @@ -934,7 +934,7 @@ void StickerSetBox::Inner::install() { MTP_bool(false) )).done([=](const MTPmessages_StickerSetInstallResult &result) { installDone(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _errors.fire(Error::NotFound); }).send(); } @@ -947,7 +947,7 @@ void StickerSetBox::Inner::archiveStickers() { if (result.type() == mtpc_messages_stickerSetInstallResultSuccess) { _setArchived.fire_copy(_setId); } - }).fail([](const MTP::Error &error) { + }).fail([] { Ui::Toast::Show(Lang::Hard::ServerError()); }).send(); } diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index f7e842087..763ef4101 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -1897,7 +1897,7 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() { }, [](const MTPDmessages_stickerSetNotModified &) { LOG(("API Error: Unexpected messages.stickerSetNotModified.")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _megagroupSetRequestId = 0; setMegagroupSelectedSet({}); }).send(); diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index 909d04747..685d3ca3c 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -67,7 +67,7 @@ void UrlAuthBox::Activate( Request(data, item, row, column); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { const auto button = HistoryMessageMarkupButton::Get( &session->data(), itemId, @@ -105,7 +105,7 @@ void UrlAuthBox::Activate( }, [&](const MTPDurlAuthResultRequest &data) { Request(data, session, url, context); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { HiddenUrlClickHandler::Open(url, context); }).send(); } @@ -165,7 +165,7 @@ void UrlAuthBox::Request( return url; }); finishWithUrl(to); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finishWithUrl(url); }).send(); } @@ -216,7 +216,7 @@ void UrlAuthBox::Request( return url; }); finishWithUrl(to); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finishWithUrl(url); }).send(); } diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index 8a5455e91..85bc8ab86 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -344,7 +344,7 @@ void BoxController::loadMoreRows() { } break; default: Unexpected("Type of messages.Messages (Calls::BoxController::preloadRows)"); } - }).fail([this](const MTP::Error &error) { + }).fail([this] { _loadRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index a38203ff6..a592d2e64 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -1209,7 +1209,7 @@ void Call::finish(FinishType type, const MTPPhoneCallDiscardReason &reason) { // updates being handled, but in a guarded way. crl::on_main(weak, [=] { setState(finalState); }); session->api().applyUpdates(result); - }).fail(crl::guard(weak, [this, finalState](const MTP::Error &error) { + }).fail(crl::guard(weak, [this, finalState] { setState(finalState); })).send(); } diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 3d1750a12..d5ed48eb9 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -332,7 +332,7 @@ void Instance::refreshDhConfig() { } else { _delegate->callFailed(call); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { const auto call = weak.get(); if (!call) { return; @@ -391,7 +391,7 @@ void Instance::refreshServerConfig(not_null session) { const auto &json = result.c_dataJSON().vdata().v; UpdateConfig(std::string(json.data(), json.size())); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _serverConfigRequestSession = nullptr; }).send(); } diff --git a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp index 655f1165e..4293feeea 100644 --- a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp +++ b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp @@ -467,7 +467,7 @@ void ChooseJoinAsProcess::start( _request->box = box.data(); _request->showBox(std::move(box)); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finish({ .peer = _request->peer, .joinAs = _request->peer->session().user(), diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index bcee0a6cc..b63d57804 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -1604,7 +1604,7 @@ void GroupCall::discard() { // updates being handled, but in a guarded way. crl::on_main(this, [=] { hangup(); }); _peer->session().api().applyUpdates(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { hangup(); }).send(); } @@ -1672,7 +1672,7 @@ void GroupCall::leave() { // updates being handled, but in a guarded way. crl::on_main(weak, [=] { setState(finalState); }); session->api().applyUpdates(result); - }).fail(crl::guard(weak, [=](const MTP::Error &error) { + }).fail(crl::guard(weak, [=] { setState(finalState); })).send(); } @@ -2225,7 +2225,6 @@ void GroupCall::changeTitle(const QString &title) { )).done([=](const MTPUpdates &result) { _peer->session().api().applyUpdates(result); _titleChanged.fire({}); - }).fail([=](const MTP::Error &error) { }).send(); } @@ -2258,7 +2257,7 @@ void GroupCall::toggleRecording( )).done([=](const MTPUpdates &result) { _peer->session().api().applyUpdates(result); _recordingStoppedByMe = false; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _recordingStoppedByMe = false; }).send(); } diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index 72eb9b1d9..a532de970 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -400,7 +400,7 @@ void EmojiKeywords::LangPack::refresh() { _requestId = 0; _lastRefreshTime = crl::now(); applyDifference(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; _lastRefreshTime = crl::now(); }).send(); @@ -670,7 +670,7 @@ void EmojiKeywords::refreshRemoteList() { }); }) | ranges::to_vector); _langsRequestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _langsRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index dfe99608f..213fcdac1 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -854,7 +854,7 @@ void GifsListWidget::sendInlineRequest() { MTP_string(nextOffset) )).done([this](const MTPmessages_BotResults &result) { inlineResultsDone(result); - }).fail([this](const MTP::Error &error) { + }).fail([this] { // show error? _footer->setLoading(false); _inlineRequestId = 0; diff --git a/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp b/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp index dea870e14..9c3ac27ff 100644 --- a/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp +++ b/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp @@ -160,7 +160,7 @@ void SetupUnreadMentionsMenu( )).done([=](const MTPmessages_AffectedHistory &result) { state->sentForPeers.remove(peer); peer->session().api().applyAffectedHistory(peer, result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { state->sentForPeers.remove(peer); }).send(); }); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp index b1fb1a35f..d197246e8 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp @@ -55,7 +55,7 @@ void DicePack::load() { }, [](const MTPDmessages_stickerSetNotModified &) { LOG(("API Error: Unexpected messages.stickerSetNotModified.")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp index b4adb759b..d663f4290 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp @@ -237,7 +237,7 @@ void EmojiPack::refreshAnimations() { }, [](const MTPDmessages_stickerSetNotModified &) { LOG(("API Error: Unexpected messages.stickerSetNotModified.")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _animationsRequestId = 0; refreshDelayed(); }).send(); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index c907c5f5e..eeccc6f36 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -1106,7 +1106,6 @@ void StickersListWidget::preloadMoreOfficial() { }); resizeToWidth(width()); update(); - }).fail([=](const MTP::Error &error) { }).send(); } @@ -1276,7 +1275,7 @@ void StickersListWidget::sendSearchRequest() { MTP_long(hash) )).done([=](const MTPmessages_FoundStickerSets &result) { searchResultsDone(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { // show error? _footer->setLoading(false); _searchRequestId = 0; @@ -3149,7 +3148,7 @@ void StickersListWidget::sendInstallRequest( session().data().stickers().applyArchivedResult( result.c_messages_stickerSetInstallResultArchive()); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { notInstalledLocally(setId); session().data().stickers().undoInstallLocally(setId); }).send(); diff --git a/Telegram/SourceFiles/data/data_chat_filters.cpp b/Telegram/SourceFiles/data/data_chat_filters.cpp index d54da1ce9..93628a42c 100644 --- a/Telegram/SourceFiles/data/data_chat_filters.cpp +++ b/Telegram/SourceFiles/data/data_chat_filters.cpp @@ -256,7 +256,7 @@ void ChatFilters::load(bool force) { )).done([=](const MTPVector &result) { received(result.v); _loadRequestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _loadRequestId = 0; }).send(); } @@ -555,7 +555,7 @@ bool ChatFilters::loadNextExceptions(bool chatsListLoaded) { _exceptionsLoadRequestId = 0; _owner->session().data().histories().applyPeerDialogs(result); _owner->session().api().requestMoreDialogsIfNeeded(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _exceptionsLoadRequestId = 0; _owner->session().api().requestMoreDialogsIfNeeded(); }).send(); @@ -594,7 +594,7 @@ void ChatFilters::requestSuggested() { }) | ranges::to_vector; _suggestedUpdated.fire({}); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _suggestedRequestId = 0; _suggestedLastReceived = crl::now() + kRefreshSuggestedTimeout / 2; diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index 315e30e10..15e07a476 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -192,7 +192,7 @@ void CloudThemes::reloadCurrent() { MTP_long(fields.documentId) )).done([=](const MTPTheme &result) { applyUpdate(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _reloadCurrentTimer.callOnce(kReloadTimeout); }).send(); } @@ -345,7 +345,7 @@ void CloudThemes::refresh() { _updates.fire({}); }, [](const MTPDaccount_themesNotModified &) { }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _refreshRequestId = 0; }).send(); } @@ -373,7 +373,7 @@ void CloudThemes::refreshChatThemes() { _chatThemesUpdates.fire({}); }, [](const MTPDaccount_themesNotModified &) { }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _chatThemesRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index f3ef08f80..3139e752d 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -135,7 +135,7 @@ void GroupCall::requestParticipants() { _participantsReloaded.fire({}); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _participantsRequestId = 0; const auto reloaded = processSavedFullCall(); setServerParticipantsCount(_participants.size()); @@ -511,7 +511,7 @@ void GroupCall::reload() { } _reloadRequestId = 0; processFullCall(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _reloadRequestId = 0; }).send(); } @@ -898,7 +898,7 @@ void GroupCall::requestUnknownParticipants() { _participantsResolved.fire(&ssrcs); } requestUnknownParticipants(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _unknownParticipantPeersRequestId = 0; for (const auto &[ssrc, when] : ssrcs) { _unknownSpokenSsrcs.remove(ssrc); diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 21836dc17..cafcd577a 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -268,7 +268,7 @@ void Histories::requestDialogEntry(not_null folder) { )).done([=](const MTPmessages_PeerDialogs &result) { applyPeerDialogs(result); _dialogFolderRequests.remove(folder); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _dialogFolderRequests.remove(folder); }).send(); } @@ -348,7 +348,7 @@ void Histories::sendDialogRequests() { )).done([=](const MTPmessages_PeerDialogs &result) { applyPeerDialogs(result); finalize(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finalize(); }).send(); } @@ -428,7 +428,7 @@ void Histories::requestFakeChatListMessage( _fakeChatListRequests.erase(history); history->setFakeChatListMessageFrom(result); finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _fakeChatListRequests.erase(history); history->setFakeChatListMessageFrom(MTP_messages_messages( MTP_vector(0), @@ -472,7 +472,7 @@ void Histories::requestGroupAround(not_null item) { history->channelId(), result); finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _chatListGroupRequests.remove(history); finish(); }).send(); @@ -555,7 +555,7 @@ void Histories::sendReadRequest(not_null history, State &state) { MTP_int(tillId) )).done([=](const MTPBool &result) { finished(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finished(); }).send(); } else { @@ -565,7 +565,7 @@ void Histories::sendReadRequest(not_null history, State &state) { )).done([=](const MTPmessages_AffectedMessages &result) { session().api().applyAffectedMessages(history->peer, result); finished(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finished(); }).send(); } @@ -610,20 +610,17 @@ void Histories::deleteMessages( finish(); history->requestChatListMessage(); }; - const auto fail = [=](const MTP::Error &error) { - finish(); - }; if (const auto channel = history->peer->asChannel()) { return session().api().request(MTPchannels_DeleteMessages( channel->inputChannel, MTP_vector(ids) - )).done(done).fail(fail).send(); + )).done(done).fail(finish).send(); } else { using Flag = MTPmessages_DeleteMessages::Flag; return session().api().request(MTPmessages_DeleteMessages( MTP_flags(revoke ? Flag::f_revoke : Flag(0)), MTP_vector(ids) - )).done(done).fail(fail).send(); + )).done(done).fail(finish).send(); } }); } @@ -635,9 +632,6 @@ void Histories::deleteAllMessages( bool revoke) { sendRequest(history, RequestType::Delete, [=](Fn finish) { const auto peer = history->peer; - const auto fail = [=](const MTP::Error &error) { - finish(); - }; const auto chat = peer->asChat(); const auto channel = peer->asChannel(); if (!justClear && revoke && channel && channel->canDelete()) { @@ -656,7 +650,7 @@ void Histories::deleteAllMessages( MTP_int(deleteTillId) )).done([=](const MTPBool &result) { finish(); - }).fail(fail).send(); + }).fail(finish).send(); } else if (revoke && chat && chat->amCreator()) { return session().api().request(MTPmessages_DeleteChat( chat->inputChat @@ -704,7 +698,7 @@ void Histories::deleteAllMessages( revoke); } finish(); - }).fail(fail).send(); + }).fail(finish).send(); } }); } @@ -734,9 +728,6 @@ void Histories::deleteMessagesByDates( bool revoke) { sendRequest(history, RequestType::Delete, [=](Fn finish) { const auto peer = history->peer; - const auto fail = [=](const MTP::Error &error) { - finish(); - }; using Flag = MTPmessages_DeleteHistory::Flag; const auto flags = Flag::f_just_clear | Flag::f_min_date @@ -756,7 +747,7 @@ void Histories::deleteMessagesByDates( deleteMessagesByDates(history, minDate, maxDate, revoke); } finish(); - }).fail(fail).send(); + }).fail(finish).send(); }); history->destroyMessagesByDates(minDate, maxDate); } diff --git a/Telegram/SourceFiles/data/data_replies_list.cpp b/Telegram/SourceFiles/data/data_replies_list.cpp index 348374654..f02ad8f29 100644 --- a/Telegram/SourceFiles/data/data_replies_list.cpp +++ b/Telegram/SourceFiles/data/data_replies_list.cpp @@ -461,7 +461,7 @@ void RepliesList::loadAround(MsgId id) { _skippedBefore = 0; } } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _beforeId = 0; _loadingAround = std::nullopt; finish(); @@ -509,7 +509,7 @@ void RepliesList::loadBefore() { _fullCount = _list.size(); } } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _beforeId = 0; finish(); }).send(); @@ -553,7 +553,7 @@ void RepliesList::loadAfter() { _fullCount = _list.size(); } } - }).fail([=](const MTP::Error &error) { + }).fail([=] { _afterId = 0; finish(); }).send(); diff --git a/Telegram/SourceFiles/data/data_scheduled_messages.cpp b/Telegram/SourceFiles/data/data_scheduled_messages.cpp index f90a0da49..292a332d6 100644 --- a/Telegram/SourceFiles/data/data_scheduled_messages.cpp +++ b/Telegram/SourceFiles/data/data_scheduled_messages.cpp @@ -389,7 +389,7 @@ void ScheduledMessages::request(not_null history) { MTP_long(hash)) ).done([=](const MTPmessages_Messages &result) { parse(history, result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requests.remove(history); }).send(); } diff --git a/Telegram/SourceFiles/data/data_search_controller.cpp b/Telegram/SourceFiles/data/data_search_controller.cpp index 1bd42b218..cbaad409f 100644 --- a/Telegram/SourceFiles/data/data_search_controller.cpp +++ b/Telegram/SourceFiles/data/data_search_controller.cpp @@ -391,7 +391,7 @@ void SearchController::requestMore( parsed.noSkipRange, parsed.fullCount); finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finish(); }).send(); }); diff --git a/Telegram/SourceFiles/data/data_sponsored_messages.cpp b/Telegram/SourceFiles/data/data_sponsored_messages.cpp index 1dc5b49d1..155dc5f90 100644 --- a/Telegram/SourceFiles/data/data_sponsored_messages.cpp +++ b/Telegram/SourceFiles/data/data_sponsored_messages.cpp @@ -124,7 +124,7 @@ void SponsoredMessages::request(not_null history) { channel->inputChannel) ).done([=](const MTPmessages_sponsoredMessages &result) { parse(history, result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requests.remove(history); }).send(); } @@ -228,7 +228,7 @@ void SponsoredMessages::view(const FullMsgId &fullId) { auto &request = _viewRequests[randomId]; request.lastReceived = crl::now(); request.requestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _viewRequests.remove(randomId); }).send(); } diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.cpp b/Telegram/SourceFiles/data/stickers/data_stickers.cpp index 86ed5b3a4..6a8988855 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.cpp +++ b/Telegram/SourceFiles/data/stickers/data_stickers.cpp @@ -539,7 +539,7 @@ void Stickers::requestSetToPushFaved(not_null document) { }, [](const MTPDmessages_stickerSetNotModified &) { LOG(("API Error: Unexpected messages.stickerSetNotModified.")); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { // Perhaps this is a deleted sticker pack. Add anyway. addAnyway({}); }).send(); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 6041feaa9..f226f70f3 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -767,7 +767,7 @@ void InnerWidget::preloadMore(Direction direction) { if (!loadedFlag) { addEvents(direction, results.vevents().v); } - }).fail([this, &requestId, &loadedFlag](const MTP::Error &error) { + }).fail([this, &requestId, &loadedFlag] { requestId = 0; loadedFlag = true; update(); @@ -1431,7 +1431,7 @@ void InnerWidget::suggestRestrictParticipant( || (type == mtpc_channelParticipantCreator); editRestrictions(hasAdminRights, ChatRestrictionsInfo()); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { editRestrictions(false, ChatRestrictionsInfo()); }).send(); } diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 601133d0b..ab8c7f616 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -321,7 +321,7 @@ void FastShareMessage(not_null item) { Ui::hideLayer(); } finish(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { finish(); }).afterRequest(history->sendRequestId).send(); return history->sendRequestId; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp index 3e432e5e6..61ec114ed 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp @@ -78,7 +78,7 @@ void AutoDeleteSettingsBox( if (const auto strong = state->weak.data()) { strong->closeBox(); } - }).fail([=](const MTP::Error &error) { + }).fail([=] { state->savingRequestId = 0; }).send(); }; diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index a4767536d..cb918c0ee 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -1124,7 +1124,6 @@ void SendReport( MTP_string(comment) )).done([=](const MTPBool &result) { Ui::Toast::Show(tr::lng_report_thanks(tr::now)); - }).fail([=](const MTP::Error &error) { }).send(); } else { auto apiIds = QVector(); @@ -1139,7 +1138,6 @@ void SendReport( MTP_string(comment) )).done([=](const MTPBool &result) { Ui::Toast::Show(tr::lng_report_thanks(tr::now)); - }).fail([=](const MTP::Error &error) { }).send(); } } diff --git a/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp b/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp index 920f34ef2..a5a55e504 100644 --- a/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp +++ b/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp @@ -298,7 +298,7 @@ void ListController::loadMoreRows() { delegate()->peerListRefreshRows(); } _loadRequestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _loadRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index d9d4123ca..0f317844a 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -447,7 +447,7 @@ void Widget::onInlineRequest() { MTP_string(nextOffset) )).done([=](const MTPmessages_BotResults &result) { inlineResultsDone(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { // show error? _requesting.fire(false); _inlineRequestId = 0; diff --git a/Telegram/SourceFiles/intro/intro_step.cpp b/Telegram/SourceFiles/intro/intro_step.cpp index 6634ec32f..c626ea867 100644 --- a/Telegram/SourceFiles/intro/intro_step.cpp +++ b/Telegram/SourceFiles/intro/intro_step.cpp @@ -166,7 +166,7 @@ void Step::finish(const MTPUser &user, QImage &&photo) { api().request(MTPmessages_GetDialogFilters( )).done([=](const MTPVector &result) { createSession(user, photo, result.v); - }).fail([=](const MTP::Error &error) { + }).fail([=] { createSession(user, photo, QVector()); }).send(); } diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index af1654626..3719af18c 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -234,7 +234,7 @@ void CloudManager::requestLangPackDifference(Pack pack) { )).done([=](const MTPLangPackDifference &result) { packRequestId(pack) = 0; applyLangPackDifference(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { packRequestId(pack) = 0; }).send(); } else { @@ -244,7 +244,7 @@ void CloudManager::requestLangPackDifference(Pack pack) { )).done([=](const MTPLangPackDifference &result) { packRequestId(pack) = 0; applyLangPackDifference(result); - }).fail([=](const MTP::Error &error) { + }).fail([=] { packRequestId(pack) = 0; }).send(); } @@ -322,7 +322,7 @@ void CloudManager::requestLanguageList() { _languageListChanged.fire({}); } _languagesRequestId = 0; - }).fail([=](const MTP::Error &error) { + }).fail([=] { _languagesRequestId = 0; }).send(); } @@ -509,7 +509,7 @@ void CloudManager::switchToLanguage(const Language &data) { tr::lng_cancel(tr::now), [=] { performSwitchAndRestart(data); }), Ui::LayerOption::KeepOther); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _getKeysForSwitchRequestId = 0; }).send(); } diff --git a/Telegram/SourceFiles/main/main_app_config.cpp b/Telegram/SourceFiles/main/main_app_config.cpp index 5c43c0bb9..fef8d9702 100644 --- a/Telegram/SourceFiles/main/main_app_config.cpp +++ b/Telegram/SourceFiles/main/main_app_config.cpp @@ -51,7 +51,7 @@ void AppConfig::refresh() { DEBUG_LOG(("getAppConfig result handled.")); } _refreshed.fire({}); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _requestId = 0; refreshDelayed(); }).send(); diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index f2bc757f5..887927553 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -1038,7 +1038,7 @@ void FormController::cancelPassword() { )).done([=](const MTPBool &result) { _passwordRequestId = 0; reloadPassword(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { _passwordRequestId = 0; reloadPassword(); }).send(); @@ -1259,7 +1259,7 @@ rpl::producer FormController::preferredLanguage( }); consumer.put_next({ countryCode, findLang() }); consumer.put_done(); - }).fail([=](const MTP::Error &error) { + }).fail([=] { consumer.put_next({ countryCode, QString() }); consumer.put_done(); }).send(); diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 2339e7b02..43bf1e9ec 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -329,7 +329,7 @@ void SetupHelp( Ui::showPeerHistory(user, ShowAtUnreadMsgId); } }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { *requestId = 0; }).send(); }); diff --git a/Telegram/SourceFiles/support/support_helper.cpp b/Telegram/SourceFiles/support/support_helper.cpp index 21b9455ab..ca112783e 100644 --- a/Telegram/SourceFiles/support/support_helper.cpp +++ b/Telegram/SourceFiles/support/support_helper.cpp @@ -263,7 +263,7 @@ Helper::Helper(not_null session) result.match([&](const MTPDhelp_supportName &data) { setSupportName(qs(data.vname())); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { setSupportName( qsl("[rand^") + QString::number(Core::Sandbox::Instance().installationTag()) @@ -529,7 +529,7 @@ void Helper::saveInfo( )).done([=](const MTPhelp_UserInfo &result) { applyInfo(user, result); done(true); - }).fail([=](const MTP::Error &error) { + }).fail([=] { done(false); }).send(); } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index 3f736ba09..c6a7b88bf 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -743,7 +743,7 @@ void SaveTheme( result.match([&](const MTPDtheme &data) { save(CloudTheme::Parse(&window->account().session(), data)); }); - }).fail([=](const MTP::Error &error) { + }).fail([=] { save(CloudTheme()); }).send(); } else { diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 7c0c591ba..cf84f7124 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -240,9 +240,7 @@ void SessionNavigation::resolveChannelById( fail(); } }); - }).fail([=](const MTP::Error &error) { - fail(); - }).send(); + }).fail(fail).send(); } void SessionNavigation::showPeerByLinkResolved( @@ -301,9 +299,7 @@ void SessionNavigation::showPeerByLinkResolved( } else { bad(); } - }).fail([=](const MTP::Error &error) { - bad(); - }).send(); + }).fail(bad).send(); }).send(); return; }