2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Handle errors in getMessages().

This commit is contained in:
John Preston
2017-11-23 19:41:13 +04:00
parent 39428841e4
commit efdba3a482
6 changed files with 57 additions and 11 deletions

View File

@@ -248,12 +248,18 @@ bool HistoryService::updateDependent(bool force) {
if (!dependent->lnk) {
dependent->lnk = goToMessageClickHandler(history()->peer, dependent->msgId);
}
bool gotDependencyItem = false;
auto gotDependencyItem = false;
if (!dependent->msg) {
dependent->msg = App::histItemById(channelId(), dependent->msgId);
if (dependent->msg) {
App::historyRegDependency(this, dependent->msg);
gotDependencyItem = true;
if (dependent->msg->isEmpty()) {
// Really it is deleted.
dependent->msg = nullptr;
force = true;
} else {
App::historyRegDependency(this, dependent->msg);
gotDependencyItem = true;
}
}
}
if (dependent->msg) {
@@ -687,7 +693,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
if (auto dependent = GetDependentData()) {
dependent->msgId = message.vreply_to_msg_id.v;
if (!updateDependent()) {
Auth().api().requestMessageData(history()->peer->asChannel(), dependent->msgId, HistoryDependentItemCallback(fullId()));
Auth().api().requestMessageData(
history()->peer->asChannel(),
dependent->msgId,
HistoryDependentItemCallback(fullId()));
}
}
}