Don't pass wide fake MsgId through MTPMessage.

This commit is contained in:
John Preston 2021-09-30 15:30:39 +04:00
parent 4ea72f8f89
commit ead695b101
16 changed files with 87 additions and 70 deletions

View file

@ -295,7 +295,7 @@ bool ServiceCheck::checkRippleStartPosition(QPoint position) const {
const auto viaBotId = UserId(); const auto viaBotId = UserId();
const auto groupedId = uint64(); const auto groupedId = uint64();
const auto item = history->makeMessage( const auto item = history->makeMessage(
history->owner().nextNonHistoryEntryId(), history->nextNonHistoryEntryId(),
flags, flags,
replyTo, replyTo,
viaBotId, viaBotId,

View file

@ -29,7 +29,7 @@ constexpr auto kMessagesPerPage = 50;
TimeId date, TimeId date,
const QString &text) { const QString &text) {
return history->makeServiceMessage( return history->makeServiceMessage(
history->session().data().nextNonHistoryEntryId(), history->nextNonHistoryEntryId(),
MessageFlag::FakeHistoryItem, MessageFlag::FakeHistoryItem,
date, date,
HistoryService::PreparedText{ text }); HistoryService::PreparedText{ text });
@ -101,7 +101,7 @@ rpl::producer<MessagesSlice> RepliesList::source(
_partLoaded.events( _partLoaded.events(
) | rpl::start_with_next(pushDelayed, lifetime); ) | rpl::start_with_next(pushDelayed, lifetime);
_history->session().data().channelDifferenceTooLong( _history->owner().channelDifferenceTooLong(
) | rpl::filter([=](not_null<ChannelData*> channel) { ) | rpl::filter([=](not_null<ChannelData*> channel) {
if (_history->peer != channel || !_skippedAfter.has_value()) { if (_history->peer != channel || !_skippedAfter.has_value()) {
return false; return false;

View file

@ -32,18 +32,18 @@ constexpr auto kRequestTimeLimit = 60 * crl::time(1000);
&& (item->date() > base::unixtime::now()); && (item->date() > base::unixtime::now());
} }
MTPMessage PrepareMessage(const MTPMessage &message, MsgId id) { MTPMessage PrepareMessage(const MTPMessage &message) {
return message.match([&](const MTPDmessageEmpty &data) { return message.match([&](const MTPDmessageEmpty &data) {
return MTP_messageEmpty( return MTP_messageEmpty(
data.vflags(), data.vflags(),
MTP_int(id), data.vid(),
data.vpeer_id() ? *data.vpeer_id() : MTPPeer()); data.vpeer_id() ? *data.vpeer_id() : MTPPeer());
}, [&](const MTPDmessageService &data) { }, [&](const MTPDmessageService &data) {
return MTP_messageService( return MTP_messageService(
MTP_flags(data.vflags().v MTP_flags(data.vflags().v
| MTPDmessageService::Flag( | MTPDmessageService::Flag(
MTPDmessage::Flag::f_from_scheduled)), MTPDmessage::Flag::f_from_scheduled)),
MTP_int(id), data.vid(),
data.vfrom_id() ? *data.vfrom_id() : MTPPeer(), data.vfrom_id() ? *data.vfrom_id() : MTPPeer(),
data.vpeer_id(), data.vpeer_id(),
data.vreply_to() ? *data.vreply_to() : MTPMessageReplyHeader(), data.vreply_to() ? *data.vreply_to() : MTPMessageReplyHeader(),
@ -53,7 +53,7 @@ MTPMessage PrepareMessage(const MTPMessage &message, MsgId id) {
}, [&](const MTPDmessage &data) { }, [&](const MTPDmessage &data) {
return MTP_message( return MTP_message(
MTP_flags(data.vflags().v | MTPDmessage::Flag::f_from_scheduled), MTP_flags(data.vflags().v | MTPDmessage::Flag::f_from_scheduled),
MTP_int(id), data.vid(),
data.vfrom_id() ? *data.vfrom_id() : MTPPeer(), data.vfrom_id() ? *data.vfrom_id() : MTPPeer(),
data.vpeer_id(), data.vpeer_id(),
data.vfwd_from() ? *data.vfwd_from() : MTPMessageFwdHeader(), data.vfwd_from() ? *data.vfwd_from() : MTPMessageFwdHeader(),
@ -192,6 +192,7 @@ void ScheduledMessages::sendNowSimpleMessage(
const auto views = 1; const auto views = 1;
const auto forwards = 0; const auto forwards = 0;
history->addNewMessage( history->addNewMessage(
update.vid().v,
MTP_message( MTP_message(
MTP_flags(flags), MTP_flags(flags),
update.vid(), update.vid(),
@ -463,7 +464,8 @@ HistoryItem *ScheduledMessages::append(
} }
const auto item = _session->data().addNewMessage( const auto item = _session->data().addNewMessage(
PrepareMessage(message, history->nextNonHistoryEntryId()), history->nextNonHistoryEntryId(),
PrepareMessage(message),
MessageFlags(), // localFlags MessageFlags(), // localFlags
NewMessageType::Existing); NewMessageType::Existing);
if (!item || item->history() != history) { if (!item || item->history() != history) {

View file

@ -2166,12 +2166,21 @@ HistoryItem *Session::addNewMessage(
const MTPMessage &data, const MTPMessage &data,
MessageFlags localFlags, MessageFlags localFlags,
NewMessageType type) { NewMessageType type) {
return addNewMessage(IdFromMessage(data), data, localFlags, type);
}
HistoryItem *Session::addNewMessage(
MsgId id,
const MTPMessage &data,
MessageFlags localFlags,
NewMessageType type) {
const auto peerId = PeerFromMessage(data); const auto peerId = PeerFromMessage(data);
if (!peerId) { if (!peerId) {
return nullptr; return nullptr;
} }
const auto result = history(peerId)->addNewMessage( const auto result = history(peerId)->addNewMessage(
id,
data, data,
localFlags, localFlags,
type); type);

View file

@ -397,6 +397,11 @@ public:
const MTPMessage &data, const MTPMessage &data,
MessageFlags localFlags, MessageFlags localFlags,
NewMessageType type); NewMessageType type);
HistoryItem *addNewMessage( // Override message id.
MsgId id,
const MTPMessage &data,
MessageFlags localFlags,
NewMessageType type);
[[nodiscard]] int unreadBadge() const; [[nodiscard]] int unreadBadge() const;
[[nodiscard]] bool unreadBadgeMuted() const; [[nodiscard]] bool unreadBadgeMuted() const;

View file

@ -56,14 +56,11 @@ TimeId ExtractSentDate(const MTPMessage &message) {
}); });
} }
MTPMessage PrepareLogMessage( MTPMessage PrepareLogMessage(const MTPMessage &message, TimeId newDate) {
const MTPMessage &message,
MsgId newId,
TimeId newDate) {
return message.match([&](const MTPDmessageEmpty &data) { return message.match([&](const MTPDmessageEmpty &data) {
return MTP_messageEmpty( return MTP_messageEmpty(
data.vflags(), data.vflags(),
MTP_int(newId), data.vid(),
data.vpeer_id() ? *data.vpeer_id() : MTPPeer()); data.vpeer_id() ? *data.vpeer_id() : MTPPeer());
}, [&](const MTPDmessageService &data) { }, [&](const MTPDmessageService &data) {
const auto removeFlags = MTPDmessageService::Flag::f_out const auto removeFlags = MTPDmessageService::Flag::f_out
@ -72,7 +69,7 @@ MTPMessage PrepareLogMessage(
| MTPDmessageService::Flag::f_ttl_period; | MTPDmessageService::Flag::f_ttl_period;
return MTP_messageService( return MTP_messageService(
MTP_flags(data.vflags().v & ~removeFlags), MTP_flags(data.vflags().v & ~removeFlags),
MTP_int(newId), data.vid(),
data.vfrom_id() ? *data.vfrom_id() : MTPPeer(), data.vfrom_id() ? *data.vfrom_id() : MTPPeer(),
data.vpeer_id(), data.vpeer_id(),
MTPMessageReplyHeader(), MTPMessageReplyHeader(),
@ -93,7 +90,7 @@ MTPMessage PrepareLogMessage(
| MTPDmessage::Flag::f_ttl_period; | MTPDmessage::Flag::f_ttl_period;
return MTP_message( return MTP_message(
MTP_flags(data.vflags().v & ~removeFlags), MTP_flags(data.vflags().v & ~removeFlags),
MTP_int(newId), data.vid(),
data.vfrom_id() ? *data.vfrom_id() : MTPPeer(), data.vfrom_id() ? *data.vfrom_id() : MTPPeer(),
data.vpeer_id(), data.vpeer_id(),
data.vfwd_from() ? *data.vfwd_from() : MTPMessageFwdHeader(), data.vfwd_from() ? *data.vfwd_from() : MTPMessageFwdHeader(),
@ -669,10 +666,8 @@ void GenerateItems(
auto detachExistingItem = false; auto detachExistingItem = false;
addPart( addPart(
history->createItem( history->createItem(
PrepareLogMessage( history->nextNonHistoryEntryId(),
action.vmessage(), PrepareLogMessage(action.vmessage(), date),
history->nextNonHistoryEntryId(),
date),
MessageFlag::AdminLogEntry, MessageFlag::AdminLogEntry,
detachExistingItem), detachExistingItem),
ExtractSentDate(action.vmessage())); ExtractSentDate(action.vmessage()));
@ -698,10 +693,8 @@ void GenerateItems(
auto oldValue = ExtractEditedText(session, action.vprev_message()); auto oldValue = ExtractEditedText(session, action.vprev_message());
auto detachExistingItem = false; auto detachExistingItem = false;
auto body = history->createItem( auto body = history->createItem(
PrepareLogMessage( history->nextNonHistoryEntryId(),
action.vnew_message(), PrepareLogMessage(action.vnew_message(), date),
history->nextNonHistoryEntryId(),
date),
MessageFlag::AdminLogEntry, MessageFlag::AdminLogEntry,
detachExistingItem); detachExistingItem);
if (oldValue.text.isEmpty()) { if (oldValue.text.isEmpty()) {
@ -724,10 +717,8 @@ void GenerateItems(
auto detachExistingItem = false; auto detachExistingItem = false;
addPart( addPart(
history->createItem( history->createItem(
PrepareLogMessage( history->nextNonHistoryEntryId(),
action.vmessage(), PrepareLogMessage(action.vmessage(), date),
history->nextNonHistoryEntryId(),
date),
MessageFlag::AdminLogEntry, MessageFlag::AdminLogEntry,
detachExistingItem), detachExistingItem),
ExtractSentDate(action.vmessage())); ExtractSentDate(action.vmessage()));
@ -821,10 +812,8 @@ void GenerateItems(
auto detachExistingItem = false; auto detachExistingItem = false;
addPart( addPart(
history->createItem( history->createItem(
PrepareLogMessage( history->nextNonHistoryEntryId(),
action.vmessage(), PrepareLogMessage(action.vmessage(), date),
history->nextNonHistoryEntryId(),
date),
MessageFlag::AdminLogEntry, MessageFlag::AdminLogEntry,
detachExistingItem), detachExistingItem),
ExtractSentDate(action.vmessage())); ExtractSentDate(action.vmessage()));

View file

@ -360,21 +360,17 @@ void History::setForwardDraft(Data::ForwardDraft &&draft) {
} }
HistoryItem *History::createItem( HistoryItem *History::createItem(
MsgId id,
const MTPMessage &message, const MTPMessage &message,
MessageFlags localFlags, MessageFlags localFlags,
bool detachExistingItem) { bool detachExistingItem) {
const auto messageId = IdFromMessage(message); if (const auto result = owner().message(channelId(), id)) {
if (!messageId) {
return nullptr;
}
if (const auto result = owner().message(channelId(), messageId)) {
if (detachExistingItem) { if (detachExistingItem) {
result->removeMainView(); result->removeMainView();
} }
return result; return result;
} }
return HistoryItem::Create(this, message, localFlags); return HistoryItem::Create(this, id, message, localFlags);
} }
std::vector<not_null<HistoryItem*>> History::createItems( std::vector<not_null<HistoryItem*>> History::createItems(
@ -382,9 +378,14 @@ std::vector<not_null<HistoryItem*>> History::createItems(
auto result = std::vector<not_null<HistoryItem*>>(); auto result = std::vector<not_null<HistoryItem*>>();
result.reserve(data.size()); result.reserve(data.size());
const auto localFlags = MessageFlags(); const auto localFlags = MessageFlags();
const auto detachExistingItem = true;
for (auto i = data.cend(), e = data.cbegin(); i != e;) { for (auto i = data.cend(), e = data.cbegin(); i != e;) {
const auto detachExistingItem = true; const auto &data = *--i;
const auto item = createItem(*--i, localFlags, detachExistingItem); const auto item = createItem(
IdFromMessage(data),
data,
localFlags,
detachExistingItem);
if (item) { if (item) {
result.emplace_back(item); result.emplace_back(item);
} }
@ -393,11 +394,12 @@ std::vector<not_null<HistoryItem*>> History::createItems(
} }
HistoryItem *History::addNewMessage( HistoryItem *History::addNewMessage(
MsgId id,
const MTPMessage &msg, const MTPMessage &msg,
MessageFlags localFlags, MessageFlags localFlags,
NewMessageType type) { NewMessageType type) {
const auto detachExistingItem = (type == NewMessageType::Unread); const auto detachExistingItem = (type == NewMessageType::Unread);
const auto item = createItem(msg, localFlags, detachExistingItem); const auto item = createItem(id, msg, localFlags, detachExistingItem);
if (!item) { if (!item) {
return nullptr; return nullptr;
} }
@ -744,11 +746,14 @@ void History::addUnreadMentionsSlice(const MTPmessages_Messages &result) {
const auto localFlags = MessageFlags(); const auto localFlags = MessageFlags();
const auto type = NewMessageType::Existing; const auto type = NewMessageType::Existing;
for (const auto &message : *messages) { for (const auto &message : *messages) {
if (const auto item = addNewMessage(message, localFlags, type)) { const auto item = addNewMessage(
if (item->isUnreadMention()) { IdFromMessage(message),
_unreadMentions.insert(item->id); message,
added = true; localFlags,
} type);
if (item && item->isUnreadMention()) {
_unreadMentions.insert(item->id);
added = true;
} }
} }
} }

View file

@ -134,12 +134,10 @@ public:
void unpinAllMessages(); void unpinAllMessages();
HistoryItem *addNewMessage( HistoryItem *addNewMessage(
MsgId id,
const MTPMessage &msg, const MTPMessage &msg,
MessageFlags localFlags, MessageFlags localFlags,
NewMessageType type); NewMessageType type);
HistoryItem *addToHistory(
const MTPMessage &msg,
MessageFlags localFlags);
not_null<HistoryItem*> addNewLocalMessage( not_null<HistoryItem*> addNewLocalMessage(
MsgId id, MsgId id,
MessageFlags flags, MessageFlags flags,
@ -194,6 +192,7 @@ public:
// Used only internally and for channel admin log. // Used only internally and for channel admin log.
HistoryItem *createItem( HistoryItem *createItem(
MsgId id,
const MTPMessage &message, const MTPMessage &message,
MessageFlags localFlags, MessageFlags localFlags,
bool detachExistingItem); bool detachExistingItem);
@ -418,7 +417,7 @@ public:
[[nodiscard]] std::pair<Element*, int> findItemAndOffset(int top) const; [[nodiscard]] std::pair<Element*, int> findItemAndOffset(int top) const;
MsgId nextNonHistoryEntryId(); [[nodiscard]] MsgId nextNonHistoryEntryId();
bool folderKnown() const override; bool folderKnown() const override;
Data::Folder *folder() const override; Data::Folder *folder() const override;

View file

@ -1089,6 +1089,7 @@ MessageFlags FlagsFromMTP(MTPDmessageService::Flags flags) {
not_null<HistoryItem*> HistoryItem::Create( not_null<HistoryItem*> HistoryItem::Create(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPMessage &message, const MTPMessage &message,
MessageFlags localFlags) { MessageFlags localFlags) {
return message.match([&](const MTPDmessage &data) -> HistoryItem* { return message.match([&](const MTPDmessage &data) -> HistoryItem* {
@ -1099,7 +1100,7 @@ not_null<HistoryItem*> HistoryItem::Create(
if (checked == MediaCheckResult::Unsupported) { if (checked == MediaCheckResult::Unsupported) {
return CreateUnsupportedMessage( return CreateUnsupportedMessage(
history, history,
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
MsgId(0), // No need to pass reply_to data here. MsgId(0), // No need to pass reply_to data here.
data.vvia_bot_id().value_or_empty(), data.vvia_bot_id().value_or_empty(),
@ -1110,28 +1111,24 @@ not_null<HistoryItem*> HistoryItem::Create(
tr::lng_message_empty(tr::now) tr::lng_message_empty(tr::now)
}; };
return history->makeServiceMessage( return history->makeServiceMessage(
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
data.vdate().v, data.vdate().v,
text, text,
data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)); data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0));
} else if (checked == MediaCheckResult::HasTimeToLive) { } else if (checked == MediaCheckResult::HasTimeToLive) {
return history->makeServiceMessage(data, localFlags); return history->makeServiceMessage(id, data, localFlags);
} }
return history->makeMessage(data, localFlags); return history->makeMessage(id, data, localFlags);
}, [&](const MTPDmessageService &data) -> HistoryItem* { }, [&](const MTPDmessageService &data) -> HistoryItem* {
if (data.vaction().type() == mtpc_messageActionPhoneCall) { if (data.vaction().type() == mtpc_messageActionPhoneCall) {
return history->makeMessage(data, localFlags); return history->makeMessage(id, data, localFlags);
} }
return history->makeServiceMessage(data, localFlags); return history->makeServiceMessage(id, data, localFlags);
}, [&](const MTPDmessageEmpty &data) -> HistoryItem* { }, [&](const MTPDmessageEmpty &data) -> HistoryItem* {
const auto text = HistoryService::PreparedText{ const auto text = HistoryService::PreparedText{
tr::lng_message_empty(tr::now) tr::lng_message_empty(tr::now)
}; };
return history->makeServiceMessage( return history->makeServiceMessage(id, localFlags, TimeId(0), text);
data.vid().v,
localFlags,
TimeId(0),
text);
}); });
} }

View file

@ -81,6 +81,7 @@ class HistoryItem : public RuntimeComposer<HistoryItem> {
public: public:
static not_null<HistoryItem*> Create( static not_null<HistoryItem*> Create(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPMessage &message, const MTPMessage &message,
MessageFlags localFlags); MessageFlags localFlags);

View file

@ -453,11 +453,12 @@ void HistoryMessage::FillForwardedInfo(
HistoryMessage::HistoryMessage( HistoryMessage::HistoryMessage(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessage &data, const MTPDmessage &data,
MessageFlags localFlags) MessageFlags localFlags)
: HistoryItem( : HistoryItem(
history, history,
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
data.vdate().v, data.vdate().v,
data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) { data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) {
@ -509,11 +510,12 @@ HistoryMessage::HistoryMessage(
HistoryMessage::HistoryMessage( HistoryMessage::HistoryMessage(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessageService &data, const MTPDmessageService &data,
MessageFlags localFlags) MessageFlags localFlags)
: HistoryItem( : HistoryItem(
history, history,
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
data.vdate().v, data.vdate().v,
data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) { data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) {

View file

@ -48,10 +48,12 @@ class HistoryMessage final : public HistoryItem {
public: public:
HistoryMessage( HistoryMessage(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessage &data, const MTPDmessage &data,
MessageFlags localFlags); MessageFlags localFlags);
HistoryMessage( HistoryMessage(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessageService &data, const MTPDmessageService &data,
MessageFlags localFlags); MessageFlags localFlags);
HistoryMessage( HistoryMessage(

View file

@ -866,11 +866,12 @@ HistoryService::PreparedText HistoryService::prepareCallScheduledText(
HistoryService::HistoryService( HistoryService::HistoryService(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessage &data, const MTPDmessage &data,
MessageFlags localFlags) MessageFlags localFlags)
: HistoryItem( : HistoryItem(
history, history,
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
data.vdate().v, data.vdate().v,
data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) { data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) {
@ -880,11 +881,12 @@ HistoryService::HistoryService(
HistoryService::HistoryService( HistoryService::HistoryService(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessageService &data, const MTPDmessageService &data,
MessageFlags localFlags) MessageFlags localFlags)
: HistoryItem( : HistoryItem(
history, history,
data.vid().v, id,
FlagsFromMTP(data.vflags().v) | localFlags, FlagsFromMTP(data.vflags().v) | localFlags,
data.vdate().v, data.vdate().v,
data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) { data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(0)) {

View file

@ -69,10 +69,12 @@ public:
HistoryService( HistoryService(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessage &data, const MTPDmessage &data,
MessageFlags localFlags); MessageFlags localFlags);
HistoryService( HistoryService(
not_null<History*> history, not_null<History*> history,
MsgId id,
const MTPDmessageService &data, const MTPDmessageService &data,
MessageFlags localFlags); MessageFlags localFlags);
HistoryService( HistoryService(

View file

@ -136,7 +136,7 @@ AdminLog::OwnedItem GenerateForwardedItem(
const auto flags = Flag::f_from_id | Flag::f_fwd_from; const auto flags = Flag::f_from_id | Flag::f_fwd_from;
const auto item = MTP_message( const auto item = MTP_message(
MTP_flags(flags), MTP_flags(flags),
MTP_int(history->owner().nextNonHistoryEntryId()), MTP_int(0),
peerToMTP(history->peer->id), peerToMTP(history->peer->id),
peerToMTP(history->peer->id), peerToMTP(history->peer->id),
MTP_messageFwdHeader( MTP_messageFwdHeader(
@ -166,7 +166,10 @@ AdminLog::OwnedItem GenerateForwardedItem(
MTPVector<MTPRestrictionReason>(), MTPVector<MTPRestrictionReason>(),
MTPint() // ttl_period MTPint() // ttl_period
).match([&](const MTPDmessage &data) { ).match([&](const MTPDmessage &data) {
return history->makeMessage(data, MessageFlag::FakeHistoryItem); return history->makeMessage(
history->nextNonHistoryEntryId(),
data,
MessageFlag::FakeHistoryItem);
}, [](auto &&) -> not_null<HistoryMessage*> { }, [](auto &&) -> not_null<HistoryMessage*> {
Unexpected("Type in GenerateForwardedItem."); Unexpected("Type in GenerateForwardedItem.");
}); });

View file

@ -19,7 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_service_message.h" #include "history/view/history_view_service_message.h"
#include "history/history_message.h" #include "history/history_message.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "data/data_session.h"
#include "base/unixtime.h" #include "base/unixtime.h"
#include "base/call_delayed.h" #include "base/call_delayed.h"
#include "base/qt_adapters.h" #include "base/qt_adapters.h"
@ -281,7 +280,7 @@ AdminLog::OwnedItem GenerateCommentItem(
const auto viaBotId = UserId(); const auto viaBotId = UserId();
const auto groupedId = uint64(); const auto groupedId = uint64();
const auto item = history->makeMessage( const auto item = history->makeMessage(
history->owner().nextNonHistoryEntryId(), history->nextNonHistoryEntryId(),
flags, flags,
replyTo, replyTo,
viaBotId, viaBotId,
@ -304,7 +303,7 @@ AdminLog::OwnedItem GenerateContactItem(
const auto postAuthor = QString(); const auto postAuthor = QString();
const auto groupedId = uint64(); const auto groupedId = uint64();
const auto item = history->makeMessage( const auto item = history->makeMessage(
history->owner().nextNonHistoryEntryId(), history->nextNonHistoryEntryId(),
(MessageFlag::HasFromId (MessageFlag::HasFromId
| MessageFlag::Outgoing | MessageFlag::Outgoing
| MessageFlag::FakeHistoryItem), | MessageFlag::FakeHistoryItem),