Support General forum topic links.

This commit is contained in:
levlam 2022-12-05 14:13:55 +03:00
parent 374f3249be
commit a40acdfcc3
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -19620,6 +19620,10 @@ td_api::object_ptr<td_api::messageLinkInfo> 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<td_api::messageLinkInfo> 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);