mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Handle forum / topic links.
This commit is contained in:
parent
16e189a2ce
commit
ead427793b
6 changed files with 25 additions and 7 deletions
|
@ -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()
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_download_manager.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/event_filter.h"
|
||||
|
@ -1229,6 +1230,9 @@ void Application::closeChatFromWindows(not_null<PeerData*> peer) {
|
|||
PeerId(0),
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
}
|
||||
if (primary->openedForum().current() == peer) {
|
||||
primary->closeForum();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,8 +362,10 @@ bool ResolveUsernameOrPhone(
|
|||
}
|
||||
const auto commentParam = params.value(qsl("comment"));
|
||||
const auto commentId = commentParam.toInt();
|
||||
const auto topicParam = params.value(qsl("topic"));
|
||||
const auto topicId = topicParam.toInt();
|
||||
const auto threadParam = params.value(qsl("thread"));
|
||||
const auto threadId = threadParam.toInt();
|
||||
const auto threadId = topicId ? topicId : threadParam.toInt();
|
||||
const auto gameParam = params.value(qsl("game"));
|
||||
if (!gameParam.isEmpty() && validDomain(gameParam)) {
|
||||
startToken = gameParam;
|
||||
|
@ -422,8 +424,10 @@ bool ResolvePrivatePost(
|
|||
const auto msgId = params.value(qsl("post")).toInt();
|
||||
const auto commentParam = params.value(qsl("comment"));
|
||||
const auto commentId = commentParam.toInt();
|
||||
const auto topicParam = params.value(qsl("topic"));
|
||||
const auto topicId = topicParam.toInt();
|
||||
const auto threadParam = params.value(qsl("thread"));
|
||||
const auto threadId = threadParam.toInt();
|
||||
const auto threadId = topicId ? topicId : threadParam.toInt();
|
||||
if (!channelId || !IsServerMsgId(msgId)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -685,9 +685,12 @@ bool ListWidget::showAtPositionNow(
|
|||
&& position != Data::UnreadMessagePosition) {
|
||||
highlightMessage(position.fullId);
|
||||
}
|
||||
done(!position.fullId.peer
|
||||
|| !position.fullId.msg
|
||||
|| viewForItem(position.fullId));
|
||||
if (done) {
|
||||
const auto found = !position.fullId.peer
|
||||
|| !position.fullId.msg
|
||||
|| viewForItem(position.fullId);
|
||||
done(found);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1174,7 +1174,9 @@ void RepliesWidget::refreshJoinGroupButton() {
|
|||
}
|
||||
};
|
||||
const auto channel = _history->peer->asChannel();
|
||||
if (channel->amIn() || !channel->joinToWrite() || channel->amCreator()) {
|
||||
if (channel->amIn()
|
||||
|| !channel->joinToWrite()
|
||||
|| (channel->amCreator() && channel->canWrite())) {
|
||||
set(nullptr);
|
||||
} else {
|
||||
if (!_joinGroup) {
|
||||
|
|
|
@ -343,6 +343,8 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
info.messageId,
|
||||
commentId->id,
|
||||
params);
|
||||
} else if (peer->isForum()) {
|
||||
parentController()->openForum(peer->asChannel(), params);
|
||||
} else if (bot
|
||||
&& (info.resolveType == ResolveType::AddToGroup
|
||||
|| info.resolveType == ResolveType::AddToChannel
|
||||
|
|
Loading…
Add table
Reference in a new issue