mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Removed unused MTP::Error from callbacks on fail.
This commit is contained in:
@@ -268,7 +268,7 @@ void Histories::requestDialogEntry(not_null<Data::Folder*> 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<MTPMessage>(0),
|
||||
@@ -472,7 +472,7 @@ void Histories::requestGroupAround(not_null<HistoryItem*> 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*> 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*> 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<MTPint>(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<MTPint>(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<void()> 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<void()> 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user