Fixed adding caption to grouped files.

Fixed #10192.
This commit is contained in:
23rd 2021-01-21 23:33:22 +03:00 committed by John Preston
parent 1ccfcc824c
commit 5277080115
2 changed files with 20 additions and 1 deletions

View file

@ -152,6 +152,25 @@ 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,

View file

@ -120,7 +120,7 @@ struct PreparedGroup {
[[nodiscard]] bool sentWithCaption() const {
return (list.files.size() == 1)
|| (type == AlbumType::PhotoVideo);
|| (type != AlbumType::None);
}
};