mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-26 02:20:46 +00:00
Changed Up arrow shortcut for albums to edit item with caption.
Fixed #10134.
This commit is contained in:
parent
ad761011d6
commit
eb42a77eb7
@ -145,4 +145,20 @@ void Groups::refreshViews(const HistoryItemsList &items) {
|
||||
}
|
||||
}
|
||||
|
||||
not_null<HistoryItem*> Groups::findItemToEdit(
|
||||
not_null<HistoryItem*> item) const {
|
||||
const auto group = find(item);
|
||||
if (!group) {
|
||||
return item;
|
||||
}
|
||||
const auto &list = group->items;
|
||||
const auto it = ranges::find_if(
|
||||
list,
|
||||
ranges::not_fn(&HistoryItem::emptyText));
|
||||
if (it == end(list)) {
|
||||
return list.front();
|
||||
}
|
||||
return (*it);
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
const Group *find(not_null<HistoryItem*> item) const;
|
||||
|
||||
not_null<HistoryItem*> findItemToEdit(not_null<HistoryItem*> item) const;
|
||||
|
||||
private:
|
||||
HistoryItemsList::const_iterator findPositionForItem(
|
||||
const HistoryItemsList &group,
|
||||
|
@ -640,7 +640,9 @@ HistoryItem *RepliesList::lastEditableMessage() {
|
||||
return false;
|
||||
};
|
||||
const auto it = ranges::find_if(_list, std::move(proj));
|
||||
return (it == end(_list)) ? nullptr : message(*it);
|
||||
return (it == end(_list))
|
||||
? nullptr
|
||||
: _history->owner().groups().findItemToEdit(message(*it));
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@ -558,8 +558,11 @@ HistoryItem *ScheduledMessages::lastEditableMessage(
|
||||
auto proj = [&](const OwnedItem &item) {
|
||||
return item->allowsEdit(now);
|
||||
};
|
||||
|
||||
const auto it = ranges::find_if(items, std::move(proj));
|
||||
return (it == end(items)) ? nullptr : (*it).get();
|
||||
return (it == end(items))
|
||||
? nullptr
|
||||
: history->owner().groups().findItemToEdit((*it).get());
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@ -2713,7 +2713,7 @@ HistoryItem *History::lastEditableMessage() const {
|
||||
for (const auto &message : ranges::view::reverse(block->messages)) {
|
||||
const auto item = message->data();
|
||||
if (item->allowsEdit(now)) {
|
||||
return item;
|
||||
return owner().groups().findItemToEdit(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user