From b97c8b9a176db09b1c2ce0987b6d0007430d87d8 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 30 Jun 2025 10:25:53 +0300 Subject: [PATCH] Fixed order of saving grouped media from bulk download menu item. --- Telegram/SourceFiles/menu/menu_item_download_files.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/menu/menu_item_download_files.cpp b/Telegram/SourceFiles/menu/menu_item_download_files.cpp index dd510b5369..10423c6e07 100644 --- a/Telegram/SourceFiles/menu/menu_item_download_files.cpp +++ b/Telegram/SourceFiles/menu/menu_item_download_files.cpp @@ -242,10 +242,14 @@ void AddDownloadFilesAction( if (items.empty()) { return; } + auto sortedItems = ranges::views::all(items) + | ranges::views::keys + | ranges::to(); + ranges::sort(sortedItems, {}, &HistoryItem::fullId); auto docs = Documents(); auto photos = Photos(); - for (const auto &pair : items) { - if (!Added(pair.first, docs, photos)) { + for (const auto &item : sortedItems) { + if (!Added(item, docs, photos)) { return; } }