mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-04 16:35:44 +00:00
Clear DocumentMedia in ReplyPreview.
This commit is contained in:
@@ -17,8 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Data {
|
||||
|
||||
ReplyPreview::ReplyPreview(not_null<DocumentData*> document)
|
||||
: _document(document)
|
||||
, _documentMedia(_document->createMediaView()) {
|
||||
: _document(document) {
|
||||
}
|
||||
|
||||
ReplyPreview::ReplyPreview(not_null<PhotoData*> photo)
|
||||
@@ -59,7 +58,13 @@ void ReplyPreview::prepare(not_null<Image*> image, Images::Options options) {
|
||||
}
|
||||
|
||||
Image *ReplyPreview::image(Data::FileOrigin origin) {
|
||||
if (_checked) {
|
||||
return _image.get();
|
||||
}
|
||||
if (_document) {
|
||||
if (!_documentMedia) {
|
||||
_documentMedia = _document->createMediaView();
|
||||
}
|
||||
const auto thumbnail = _documentMedia->thumbnail();
|
||||
if (!_image || (!_good && thumbnail)) {
|
||||
const auto option = _document->isVideoMessage()
|
||||
@@ -73,6 +78,10 @@ Image *ReplyPreview::image(Data::FileOrigin origin) {
|
||||
prepare(image, option | Images::Option::Blurred);
|
||||
}
|
||||
}
|
||||
if (thumbnail || !_document->hasThumbnail()) {
|
||||
_checked = true;
|
||||
_documentMedia = nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Assert(_photo != nullptr);
|
||||
|
Reference in New Issue
Block a user