diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 40535d5a5..03aafb8fc 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -10034,8 +10034,8 @@ std::pair> MessagesManager::creat } int32 ttl = message_info.ttl; - bool is_content_secret = - is_secret_message_content(ttl, message_info.content->get_type()); // should be calculated before TTL is adjusted + auto content_type = message_info.content->get_type(); + bool is_content_secret = is_secret_message_content(ttl, content_type); // should be calculated before TTL is adjusted if (ttl < 0) { LOG(ERROR) << "Wrong ttl = " << ttl << " received in " << message_id << " in " << dialog_id; ttl = 0; @@ -10068,7 +10068,8 @@ std::pair> MessagesManager::creat message->is_outgoing = is_outgoing; message->is_channel_post = is_channel_post; message->contains_mention = - !is_outgoing && dialog_type != DialogType::User && (flags & MESSAGE_FLAG_HAS_MENTION) != 0; + !is_outgoing && dialog_type != DialogType::User && + ((flags & MESSAGE_FLAG_HAS_MENTION) != 0 || content_type == MessageContentType::PinMessage); message->contains_unread_mention = message_id.is_server() && message->contains_mention && (flags & MESSAGE_FLAG_HAS_UNREAD_CONTENT) != 0 && (dialog_type == DialogType::Chat || (dialog_type == DialogType::Channel && !is_broadcast_channel(dialog_id))); @@ -10080,7 +10081,6 @@ std::pair> MessagesManager::creat message->reply_markup = get_reply_markup(std::move(message_info.reply_markup), td_->auth_manager_->is_bot(), false, message->contains_mention || dialog_id.get_type() == DialogType::User); - auto content_type = message->content->get_type(); if (content_type == MessageContentType::ExpiredPhoto || content_type == MessageContentType::ExpiredVideo) { CHECK(message->ttl == 0); // ttl is ignored/set to 0 if the message has already been expired if (message->reply_markup != nullptr) {