@@ -839,6 +839,8 @@ bool HistoryItem::awaitingVideoProcessing() const {
839839HistoryServiceDependentData *HistoryItem::GetServiceDependentData () {
840840 if (const auto pinned = Get<HistoryServicePinned>()) {
841841 return pinned;
842+ } else if (const auto clear = Get<HistoryServiceClearHistory>()) {
843+ return clear;
842844 } else if (const auto gamescore = Get<HistoryServiceGameScore>()) {
843845 return gamescore;
844846 } else if (const auto payment = Get<HistoryServicePayment>()) {
@@ -2357,14 +2359,23 @@ void HistoryItem::updateForwardedInfo(const MTPMessageFwdHeader *fwd) {
23572359}
23582360
23592361void HistoryItem::applyEditionToHistoryCleared () {
2362+ const auto rootId = topicRootId ();
2363+ const auto topicPost = (rootId != Data::ForumTopic::kGeneralId );
2364+ auto action = Api::SendAction (history ());
2365+ action.replyTo = FullReplyTo{
2366+ .messageId = FullMsgId (_history->peer ->id , topicPost ? rootId : 0 ),
2367+ .topicRootId = rootId,
2368+ };
2369+ using Flag = MTPDmessageService::Flag;
23602370 applyEdition (
23612371 MTP_messageService (
2362- MTP_flags (0 ),
2372+ MTP_flags (Flag ()
2373+ | (topicPost ? Flag::f_reply_to : Flag ())),
23632374 MTP_int (id),
23642375 peerToMTP (PeerId (0 )), // from_id
23652376 peerToMTP (_history->peer ->id ),
23662377 MTPPeer (), // saved_peer_id
2367- MTPMessageReplyHeader ( ),
2378+ NewMessageReplyHeader (action ),
23682379 MTP_int (date ()),
23692380 MTP_messageActionHistoryClear (),
23702381 MTPMessageReactions (),
@@ -4738,6 +4749,8 @@ void HistoryItem::createServiceFromMtp(const MTPDmessageService &message) {
47384749 const auto type = action.type ();
47394750 if (type == mtpc_messageActionPinMessage) {
47404751 UpdateComponents (HistoryServicePinned::Bit ());
4752+ } else if (type == mtpc_messageActionHistoryClear) {
4753+ UpdateComponents (HistoryServiceClearHistory::Bit ());
47414754 } else if (type == mtpc_messageActionTopicCreate
47424755 || type == mtpc_messageActionTopicEdit) {
47434756 UpdateComponents (HistoryServiceTopicInfo::Bit ());
0 commit comments