Skip to content

Commit

Permalink
Improved display of history begin for channels with enabled auto-delete.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Nov 23, 2024
1 parent 3e49b45 commit 021a588
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/data/data_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ void MessageCursor::applyTo(not_null<Ui::InputField*> field) {
}

PeerId PeerFromMessage(const MTPmessage &message) {
return message.match([](const MTPDmessageEmpty &) {
return PeerId(0);
return message.match([](const MTPDmessageEmpty &data) {
return data.vpeer_id() ? peerFromMTP(*data.vpeer_id()) : PeerId(0);
}, [](const auto &data) {
return peerFromMTP(data.vpeer_id());
});
Expand Down
9 changes: 8 additions & 1 deletion Telegram/SourceFiles/history/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,15 @@ std::vector<not_null<HistoryItem*>> History::createItems(
const auto detachExistingItem = true;
for (auto i = data.cend(), e = data.cbegin(); i != e;) {
const auto &data = *--i;
const auto id = IdFromMessage(data);
if ((id.bare == 1) && (data.type() == mtpc_messageEmpty)) {
// The first message of channels should be a service message
// about its creation. But if channel auto-cleaning is enabled,
// the first message comes empty and is displayed incorrectly.
continue;
}
result.emplace_back(createItem(
IdFromMessage(data),
id,
data,
localFlags,
detachExistingItem));
Expand Down

0 comments on commit 021a588

Please sign in to comment.