Changed behavior to send text as caption to first file in files album.

This commit is contained in:
23rd
2026-02-27 12:03:28 +03:00
committed by John Preston
parent ff3b0fe2d9
commit 3ebec4db75
6 changed files with 157 additions and 57 deletions
+15 -3
View File
@@ -3815,10 +3815,22 @@ void ApiWrap::sendFiles(
std::shared_ptr<SendingAlbum> album,
const SendAction &action) {
const auto haveCaption = !caption.text.isEmpty();
if (haveCaption
&& !list.canAddCaption(
const auto captionAttached = !haveCaption
? false
: (list.files.size() == 1)
? list.canAddCaption(
album != nullptr,
type == SendMediaType::Photo)) {
type == SendMediaType::Photo)
: Ui::CaptionWillBeAttached(
list,
[&] {
auto way = Ui::SendFilesWay();
way.setGroupFiles(album != nullptr);
way.setSendImagesAsPhotos(type == SendMediaType::Photo);
return way;
}(),
false);
if (haveCaption && !captionAttached) {
auto message = MessageToSend(action);
message.textWithTags = base::take(caption);
message.action.clearDraft = false;