2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Move messages data to AuthSession.

This commit is contained in:
John Preston
2019-04-25 16:45:15 +04:00
parent cb3e649e61
commit 08bddc5579
49 changed files with 684 additions and 590 deletions

View File

@@ -576,7 +576,7 @@ void DeleteMessagesBox::prepare() {
PeerData *DeleteMessagesBox::checkFromSinglePeer() const {
auto result = (PeerData*)nullptr;
for (const auto fullId : std::as_const(_ids)) {
if (const auto item = App::histItemById(fullId)) {
if (const auto item = Auth().data().message(fullId)) {
const auto peer = item->history()->peer;
if (!result) {
result = peer;
@@ -606,8 +606,8 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
const auto items = ranges::view::all(
_ids
) | ranges::view::transform([](FullMsgId id) {
return App::histItemById(id);
) | ranges::view::transform([&](FullMsgId id) {
return peer->owner().message(id);
}) | ranges::view::filter([](HistoryItem *item) {
return (item != nullptr);
}) | ranges::to_vector;
@@ -754,7 +754,7 @@ void DeleteMessagesBox::deleteAndClear() {
base::flat_map<not_null<PeerData*>, QVector<MTPint>> idsByPeer;
for (const auto itemId : _ids) {
if (const auto item = App::histItemById(itemId)) {
if (const auto item = Auth().data().message(itemId)) {
const auto history = item->history();
const auto wasOnServer = IsServerMsgId(item->id);
const auto wasLast = (history->lastMessage() == item);