From 61741b53c3ba8ce1255bde45f51fd7ba41009ae1 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 29 Mar 2021 17:31:13 +0300 Subject: [PATCH] Fixed display of rescheduling selected messages in other sections. --- .../history/view/history_view_context_menu.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 0927a610bd..b640a696c1 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -441,19 +441,20 @@ bool AddRescheduleAction( not_null list) { const auto owner = &request.navigation->session().data(); - const auto goodSingle = !(!HasEditMessageAction(request, list) - || !request.item->isScheduled()); + const auto goodSingle = HasEditMessageAction(request, list) + && request.item->isScheduled(); const auto goodMany = [&] { if (goodSingle) { return false; } - if (!request.overSelection || request.selectedItems.empty()) { + const auto &items = request.selectedItems; + if (!request.overSelection || items.empty()) { return false; } - if (request.selectedItems.size() > kRescheduleLimit) { + if (items.size() > kRescheduleLimit) { return false; } - return true; + return ranges::all_of(items, &SelectedItem::canSendNow); }(); if (!goodSingle && !goodMany) { return false; @@ -476,8 +477,8 @@ bool AddRescheduleAction( if (!firstItem) { return; } - list->cancelSelection(); const auto callback = [=](Api::SendOptions options) { + list->cancelSelection(); for (const auto &id : ids) { const auto item = owner->message(id); if (!item && !item->isScheduled()) {