diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 437a49f07..3a3a6df96 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3942,7 +3942,7 @@ messageLink link:string is_public:Bool = MessageLink; //@description Contains information about a link to a message or a forum topic in a chat //@is_public True, if the link is a public link for a message in a chat //@chat_id If found, identifier of the chat to which the message belongs, 0 otherwise -//@message_thread_id If found, identifier of the message thread in which to open the message, or which to open if the message is missing +//@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing //@message If found, the linked message; may be null //@media_timestamp Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview //@for_album True, if the whole media album to which the message belongs is linked diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 92402d249..451b1dedd 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -19620,6 +19620,10 @@ td_api::object_ptr MessagesManager::get_message_link_in if (d == nullptr) { dialog_id = DialogId(); top_thread_message_id = MessageId(); + } else if (message_id == MessageId(ServerMessageId(1)) && dialog_id.get_type() == DialogType::Channel && + td_->contacts_manager_->is_forum_channel(dialog_id.get_channel_id())) { + // General topic + top_thread_message_id = message_id; } else { const Message *m = get_message(d, message_id); if (m != nullptr) { @@ -19636,7 +19640,7 @@ td_api::object_ptr MessagesManager::get_message_link_in media_timestamp = info.media_timestamp; } } - if (m->content->get_type() == MessageContentType::TopicCreate && m->top_thread_message_id.is_valid()) { + if (m->content->get_type() == MessageContentType::TopicCreate && top_thread_message_id.is_valid()) { message = nullptr; CHECK(!for_album); CHECK(media_timestamp == 0);