From 2cb69f0c2b5c01c670f5417346c01637c03e75f8 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 4 Apr 2019 11:01:10 +0300 Subject: [PATCH] Added ability to edit album items with remoteContent. --- .../SourceFiles/boxes/edit_caption_box.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 5789f9f19..287921343 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -411,10 +411,6 @@ void EditCaptionBox::createEditMediaButton() { }; if (!result.remoteContent.isEmpty()) { - // Don't use remoteContent to edit album item. - if (_isAlbum) { - return; - } auto list = Storage::PrepareMediaFromImage( QImage(), @@ -425,6 +421,21 @@ void EditCaptionBox::createEditMediaButton() { return; } + if (_isAlbum) { + const auto albumMimes = { + "image/jpeg", + "image/png", + "video/mp4", + }; + if ((ranges::find(albumMimes, list.files.front().mime) + == end(albumMimes))) { + Ui::show( + Box(lang(lng_edit_media_album_error)), + LayerOption::KeepOther); + return; + } + } + _preparedList = std::move(list); } else if (!result.paths.isEmpty()) { auto list = Storage::PrepareMediaList(