mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Refactored handle of last editable message on Up arrow in sections.
This commit is contained in:
@@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "data/data_replies_list.h"
|
||||
|
||||
#include "base/unixtime.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_service.h"
|
||||
@@ -627,22 +626,4 @@ bool RepliesList::processMessagesIsEmpty(const MTPmessages_Messages &result) {
|
||||
return (list.size() == skipped);
|
||||
}
|
||||
|
||||
HistoryItem *RepliesList::lastEditableMessage() {
|
||||
const auto message = [&](MsgId msgId) {
|
||||
return _history->owner().message(_history->channelId(), msgId);
|
||||
};
|
||||
|
||||
const auto now = base::unixtime::now();
|
||||
auto proj = [&](MsgId msgId) {
|
||||
if (const auto item = message(msgId)) {
|
||||
return item->allowsEdit(now);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const auto it = ranges::find_if(_list, std::move(proj));
|
||||
return (it == end(_list))
|
||||
? nullptr
|
||||
: _history->owner().groups().findItemToEdit(message(*it)).get();
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
||||
Reference in New Issue
Block a user