2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Added Up arrow shortcut to edit scheduled messages.

This commit is contained in:
23rd
2020-06-04 13:29:16 +03:00
parent e862215efb
commit 11018d76f1
9 changed files with 88 additions and 27 deletions

View File

@@ -527,4 +527,19 @@ int32 ScheduledMessages::countListHash(const List &list) const {
return HashFinalize(hash);
}
HistoryItem *ScheduledMessages::lastSentMessage(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 it = ranges::find_if(
items,
&HistoryItem::canBeEditedFromHistory);
return (it == end(items)) ? nullptr : (*it).get();
}
} // namespace Data

View File

@@ -32,6 +32,7 @@ public:
[[nodiscard]] HistoryItem *lookupItem(PeerId peer, MsgId msg) const;
[[nodiscard]] HistoryItem *lookupItem(FullMsgId itemId) const;
[[nodiscard]] int count(not_null<History*> history) const;
[[nodiscard]] HistoryItem *lastSentMessage(not_null<History*> history);
void checkEntitiesAndUpdate(const MTPDmessage &data);
void apply(const MTPDupdateNewScheduledMessage &update);