Support channel direct messages links.

This commit is contained in:
John Preston
2025-08-22 17:08:46 +04:00
parent 1e2531f0b1
commit 46886b4dcc
4 changed files with 27 additions and 1 deletions
@@ -431,6 +431,15 @@ void SessionNavigation::showPeerByLink(const PeerByLinkInfo &info) {
}
}
void SessionNavigation::fullInfoLoadedHook(not_null<PeerData*> peer) {
if (!_waitingDirectChannel || _waitingDirectChannel != peer) {
return;
}
const auto monoforum = peer->broadcastMonoforum();
const auto open = monoforum ? monoforum : peer.get();
showPeerHistory(open, SectionShow::Way::Forward, ShowAtUnreadMsgId);
}
void SessionNavigation::resolvePhone(
const QString &phone,
Fn<void(not_null<PeerData*>)> done) {
@@ -725,6 +734,13 @@ void SessionNavigation::showPeerByLinkResolved(
}
} else if (resolveType == ResolveType::Boost && peer->isChannel()) {
resolveBoostState(peer->asChannel());
} else if (resolveType == ResolveType::ChannelDirect
&& !peer->isFullLoaded()) {
_waitingDirectChannel = peer;
peer->updateFull();
} else if (const auto monoforum = peer->broadcastMonoforum()
; monoforum && resolveType == ResolveType::ChannelDirect) {
showPeerHistory(peer, params, ShowAtUnreadMsgId);
} else {
// Show specific posts only in channels / supergroups.
const auto msgId = peer->isChannel()
@@ -1554,6 +1570,9 @@ SessionController::SessionController(
}
}
}
if (update.flags & Data::PeerUpdate::Flag::FullInfo) {
fullInfoLoadedHook(update.peer);
}
return (update.flags & Data::PeerUpdate::Flag::FullInfo)
&& (update.peer == _showEditPeer);
}) | rpl::start_with_next([=] {