Fix General topic message links.

This commit is contained in:
John Preston 2022-12-22 11:34:56 +04:00
parent 191ea6f0f4
commit 076f0e0800

View File

@ -691,7 +691,11 @@ QString ApiWrap::exportDirectMessageLink(
auto linkThreadId = MsgId();
auto linkThreadIsTopic = false;
if (inRepliesContext) {
if (const auto rootId = item->replyToTop()) {
linkThreadIsTopic = item->history()->isForum();
const auto rootId = linkThreadIsTopic
? item->topicRootId()
: item->replyToTop();
if (rootId) {
const auto root = item->history()->owner().message(
channel->id,
rootId);
@ -711,7 +715,6 @@ QString ApiWrap::exportDirectMessageLink(
} else {
// Reply in a thread, maybe comment in a private channel.
linkThreadId = rootId;
linkThreadIsTopic = (item->topicRootId() == rootId);
}
}
}