mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 23:45:44 +00:00
Refactored handle of last editable message on Up arrow in sections.
This commit is contained in:
@@ -546,26 +546,4 @@ int32 ScheduledMessages::countListHash(const List &list) const {
|
||||
return HashFinalize(hash);
|
||||
}
|
||||
|
||||
HistoryItem *ScheduledMessages::lastEditableMessage(
|
||||
not_null<History*> history) {
|
||||
const auto i = _data.find(history);
|
||||
if (i == end(_data)) {
|
||||
return nullptr;
|
||||
}
|
||||
auto &list = i->second;
|
||||
|
||||
sort(list);
|
||||
const auto items = ranges::view::reverse(list.items);
|
||||
|
||||
const auto now = base::unixtime::now();
|
||||
auto proj = [&](const OwnedItem &item) {
|
||||
return item->allowsEdit(now);
|
||||
};
|
||||
|
||||
const auto it = ranges::find_if(items, std::move(proj));
|
||||
return (it == end(items))
|
||||
? nullptr
|
||||
: history->owner().groups().findItemToEdit((*it).get()).get();
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
Reference in New Issue
Block a user