From c84f99cf3a49554f2a7f880f5a428387875a3d2b Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 29 Mar 2019 11:39:23 +0300 Subject: [PATCH] Fixed uploading edit media with thumbnails. --- Telegram/SourceFiles/history/history_widget.cpp | 10 +++++++--- Telegram/SourceFiles/history/history_widget.h | 3 ++- Telegram/SourceFiles/storage/file_upload.cpp | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 4273c4886..bc80f9add 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4204,7 +4204,8 @@ void HistoryWidget::subscribeToUploader() { data.fullId, data.silent, data.file, - data.thumb); + data.thumb, + data.edit); }, _uploaderSubscriptions); Auth().uploader().documentProgress( ) | rpl::start_with_next([=](const FullMsgId &fullId) { @@ -4422,8 +4423,11 @@ void HistoryWidget::thumbDocumentUploaded( const FullMsgId &newId, bool silent, const MTPInputFile &file, - const MTPInputFile &thumb) { - Auth().api().sendUploadedDocument(newId, file, thumb, silent); + const MTPInputFile &thumb, + bool edit) { + edit + ? Auth().api().editUploadedDocument(newId, file, thumb, silent) + : Auth().api().sendUploadedDocument(newId, file, thumb, silent); } void HistoryWidget::photoProgress(const FullMsgId &newId) { diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 1d31de6c7..8fd8cb7cc 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -458,7 +458,8 @@ private: const FullMsgId &msgId, bool silent, const MTPInputFile &file, - const MTPInputFile &thumb); + const MTPInputFile &thumb, + bool edit = false); void documentProgress(const FullMsgId &msgId); void documentFailed(const FullMsgId &msgId); diff --git a/Telegram/SourceFiles/storage/file_upload.cpp b/Telegram/SourceFiles/storage/file_upload.cpp index c103b47dc..17e34cfb4 100644 --- a/Telegram/SourceFiles/storage/file_upload.cpp +++ b/Telegram/SourceFiles/storage/file_upload.cpp @@ -362,7 +362,8 @@ void Uploader::sendNext() { uploadingId, silent, file, - thumb }); + thumb, + uploadingData.file->edit }); } else { _documentReady.fire({ uploadingId, silent, file, uploadingData.file->edit }); }