mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Changed Up arrow shortcut for albums to edit item with caption.
Fixed #10134.
This commit is contained in:
parent
ad761011d6
commit
eb42a77eb7
5 changed files with 26 additions and 3 deletions
|
@ -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
|
} // namespace Data
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
|
|
||||||
const Group *find(not_null<HistoryItem*> item) const;
|
const Group *find(not_null<HistoryItem*> item) const;
|
||||||
|
|
||||||
|
not_null<HistoryItem*> findItemToEdit(not_null<HistoryItem*> item) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HistoryItemsList::const_iterator findPositionForItem(
|
HistoryItemsList::const_iterator findPositionForItem(
|
||||||
const HistoryItemsList &group,
|
const HistoryItemsList &group,
|
||||||
|
|
|
@ -640,7 +640,9 @@ HistoryItem *RepliesList::lastEditableMessage() {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
const auto it = ranges::find_if(_list, std::move(proj));
|
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
|
} // namespace Data
|
||||||
|
|
|
@ -558,8 +558,11 @@ HistoryItem *ScheduledMessages::lastEditableMessage(
|
||||||
auto proj = [&](const OwnedItem &item) {
|
auto proj = [&](const OwnedItem &item) {
|
||||||
return item->allowsEdit(now);
|
return item->allowsEdit(now);
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto it = ranges::find_if(items, std::move(proj));
|
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
|
} // namespace Data
|
||||||
|
|
|
@ -2713,7 +2713,7 @@ HistoryItem *History::lastEditableMessage() const {
|
||||||
for (const auto &message : ranges::view::reverse(block->messages)) {
|
for (const auto &message : ranges::view::reverse(block->messages)) {
|
||||||
const auto item = message->data();
|
const auto item = message->data();
|
||||||
if (item->allowsEdit(now)) {
|
if (item->allowsEdit(now)) {
|
||||||
return item;
|
return owner().groups().findItemToEdit(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue