diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 84d8daba3..dfc7d3baa 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1147,14 +1147,15 @@ object_ptr DetailsFiller::setupInfo() { auto linkText = LinkValue( _peer, true - ) | rpl::map([=](const QString &link) { - return link.isEmpty() + ) | rpl::map([=](const LinkWithUrl &link) { + const auto text = link.text; + return text.isEmpty() ? TextWithEntities() : Ui::Text::Link( - (link.startsWith(u"https://"_q) - ? link.mid(u"https://"_q.size()) - : link) + addToLink, - link + addToLink); + (text.startsWith(u"https://"_q) + ? text.mid(u"https://"_q.size()) + : text) + addToLink, + (addToLink.isEmpty() ? link.url : (text + addToLink))); }); auto linkLine = addInfoOneLine( (topicRootId diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index 6159fe907..3a0f9566e 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -232,12 +232,19 @@ rpl::producer AboutValue(not_null peer) { }); } -rpl::producer LinkValue(not_null peer, bool primary) { +rpl::producer LinkValue(not_null peer, bool primary) { return (primary ? PlainPrimaryUsernameValue(peer) : PlainUsernameValue(peer) | rpl::type_erased() ) | rpl::map([=](QString &&username) { - return username.isEmpty() ? QString() : UsernameUrl(peer, username); + return LinkWithUrl{ + .text = (username.isEmpty() + ? QString() + : peer->session().createInternalLinkFull(username)), + .url = (username.isEmpty() + ? QString() + : UsernameUrl(peer, username)), + }; }); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.h b/Telegram/SourceFiles/info/profile/info_profile_values.h index 625ccfa2a..72d50055a 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -69,9 +69,15 @@ rpl::producer> MigratedOrMeValue( const QString &value); [[nodiscard]] rpl::producer AboutValue( not_null peer); -[[nodiscard]] rpl::producer LinkValue( + +struct LinkWithUrl { + QString text; + QString url; +}; +[[nodiscard]] rpl::producer LinkValue( not_null peer, bool primary = false); + [[nodiscard]] rpl::producer LocationValue( not_null channel); [[nodiscard]] rpl::producer NotificationsEnabledValue(