From 0d0a79b0b57f00d6a2aeb1bde9daf63575447049 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 26 Jan 2021 12:15:54 +0400 Subject: [PATCH] Revert "Fixed adding caption to grouped files." This reverts commit 5277080115211ce717f00952444cd362ecbebc89. When sending an album of files each one of them can have its own caption that will be shown below the file. A caption for the whole album (in case of media albums) is added to the first album item. In case of media albums this caption is displayed under the whole album mosaic. But in case of an album of files this caption will be displayed under the first file, between the first and the second file of the album. This is not what user can expect when he adds a caption for an album. So we will send it as a separate comment, like it was done before. --- .../ui/chat/attach/attach_prepare.cpp | 19 ------------------- .../ui/chat/attach/attach_prepare.h | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp index a2e3f21ed..8ba397094 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp @@ -152,25 +152,6 @@ bool PreparedList::canAddCaption(bool sendingAlbum) const { } else if (!sendingAlbum) { return false; } - - // All music. - { - auto pred = [](const PreparedFile &file) { - return file.type == PreparedFile::Type::Music; - }; - if (ranges::all_of(files, std::move(pred))) { - return true; - } - } - // All files. - { - auto pred = [](const PreparedFile &file) { - return file.type == PreparedFile::Type::File; - }; - if (ranges::all_of(files, std::move(pred))) { - return true; - } - } const auto hasFiles = ranges::contains( files, PreparedFile::Type::File, diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.h b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.h index 3f9ad0453..fe7d5251d 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.h +++ b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.h @@ -120,7 +120,7 @@ struct PreparedGroup { [[nodiscard]] bool sentWithCaption() const { return (list.files.size() == 1) - || (type != AlbumType::None); + || (type == AlbumType::PhotoVideo); } };