2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Handle forum / topic links.

This commit is contained in:
John Preston
2022-10-14 18:34:04 +04:00
parent 16e189a2ce
commit ead427793b
6 changed files with 25 additions and 7 deletions

View File

@@ -659,6 +659,7 @@ QString ApiWrap::exportDirectMessageLink(
auto linkItemId = item->id;
auto linkCommentId = MsgId();
auto linkThreadId = MsgId();
auto linkThreadIsTopic = false;
if (inRepliesContext) {
if (const auto rootId = item->replyToTop()) {
const auto root = item->history()->owner().message(
@@ -680,6 +681,7 @@ QString ApiWrap::exportDirectMessageLink(
} else {
// Reply in a thread, maybe comment in a private channel.
linkThreadId = rootId;
linkThreadIsTopic = (item->topicRootId() == rootId);
}
}
}
@@ -692,7 +694,8 @@ QString ApiWrap::exportDirectMessageLink(
+ (linkCommentId
? "?comment=" + QString::number(linkCommentId.bare)
: linkThreadId
? "?thread=" + QString::number(linkThreadId.bare)
? ((linkThreadIsTopic ? "?topic=" : "?thread=")
+ QString::number(linkThreadId.bare))
: "");
if (linkChannel->hasUsername()
&& !linkChannel->isMegagroup()