Fixed display of rescheduling selected messages in other sections.

This commit is contained in:
23rd 2021-03-29 17:31:13 +03:00 committed by John Preston
parent ae74c8a6b8
commit 61741b53c3
1 changed files with 7 additions and 6 deletions

View File

@ -441,19 +441,20 @@ bool AddRescheduleAction(
not_null<ListWidget*> list) { not_null<ListWidget*> list) {
const auto owner = &request.navigation->session().data(); const auto owner = &request.navigation->session().data();
const auto goodSingle = !(!HasEditMessageAction(request, list) const auto goodSingle = HasEditMessageAction(request, list)
|| !request.item->isScheduled()); && request.item->isScheduled();
const auto goodMany = [&] { const auto goodMany = [&] {
if (goodSingle) { if (goodSingle) {
return false; return false;
} }
if (!request.overSelection || request.selectedItems.empty()) { const auto &items = request.selectedItems;
if (!request.overSelection || items.empty()) {
return false; return false;
} }
if (request.selectedItems.size() > kRescheduleLimit) { if (items.size() > kRescheduleLimit) {
return false; return false;
} }
return true; return ranges::all_of(items, &SelectedItem::canSendNow);
}(); }();
if (!goodSingle && !goodMany) { if (!goodSingle && !goodMany) {
return false; return false;
@ -476,8 +477,8 @@ bool AddRescheduleAction(
if (!firstItem) { if (!firstItem) {
return; return;
} }
list->cancelSelection();
const auto callback = [=](Api::SendOptions options) { const auto callback = [=](Api::SendOptions options) {
list->cancelSelection();
for (const auto &id : ids) { for (const auto &id : ids) {
const auto item = owner->message(id); const auto item = owner->message(id);
if (!item && !item->isScheduled()) { if (!item && !item->isScheduled()) {