2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 06:07:45 +00:00

Fix refreshing of file references

This commit is contained in:
RadRussianRus 2021-04-06 03:52:04 +03:00
parent 039a8871b5
commit dd53d8df47

View File

@ -3947,6 +3947,7 @@ void ApiWrap::forwardMessagesUnquoted(
&& error.type().startsWith(qstr("FILE_REFERENCE_"))) {
auto refreshRequests = mediaRefs->size();
auto index = 0;
auto wasUpdated = false;
for (auto i = fromIter, e = toIter; i != e; i++) {
const auto item = *i;
const auto media = item->media();
@ -3955,17 +3956,21 @@ void ApiWrap::forwardMessagesUnquoted(
: Data::FileOrigin();
const auto usedFileReference = mediaRefs->value(index);
refreshFileReference(origin, [=, &refreshRequests](const auto &result) {
if (refreshRequests > 0) {
refreshRequests--;
return;
}
refreshFileReference(origin, [=, &refreshRequests, &wasUpdated](const auto &result) {
const auto currentMediaReference = media->photo()
? media->photo()->fileReference()
: media->document()->fileReference();
if (currentMediaReference != usedFileReference) {
wasUpdated = true;
}
if (refreshRequests > 0) {
refreshRequests--;
return;
}
if (wasUpdated) {
repeatRequest(repeatRequest);
} else {
sendMessageFail(error, peer);