mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix collectible channel links.
This commit is contained in:
parent
b31d43cbed
commit
9464f4b095
3 changed files with 23 additions and 9 deletions
|
@ -1147,14 +1147,15 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
auto linkText = LinkValue(
|
auto linkText = LinkValue(
|
||||||
_peer,
|
_peer,
|
||||||
true
|
true
|
||||||
) | rpl::map([=](const QString &link) {
|
) | rpl::map([=](const LinkWithUrl &link) {
|
||||||
return link.isEmpty()
|
const auto text = link.text;
|
||||||
|
return text.isEmpty()
|
||||||
? TextWithEntities()
|
? TextWithEntities()
|
||||||
: Ui::Text::Link(
|
: Ui::Text::Link(
|
||||||
(link.startsWith(u"https://"_q)
|
(text.startsWith(u"https://"_q)
|
||||||
? link.mid(u"https://"_q.size())
|
? text.mid(u"https://"_q.size())
|
||||||
: link) + addToLink,
|
: text) + addToLink,
|
||||||
link + addToLink);
|
(addToLink.isEmpty() ? link.url : (text + addToLink)));
|
||||||
});
|
});
|
||||||
auto linkLine = addInfoOneLine(
|
auto linkLine = addInfoOneLine(
|
||||||
(topicRootId
|
(topicRootId
|
||||||
|
|
|
@ -232,12 +232,19 @@ rpl::producer<TextWithEntities> AboutValue(not_null<PeerData*> peer) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<QString> LinkValue(not_null<PeerData*> peer, bool primary) {
|
rpl::producer<LinkWithUrl> LinkValue(not_null<PeerData*> peer, bool primary) {
|
||||||
return (primary
|
return (primary
|
||||||
? PlainPrimaryUsernameValue(peer)
|
? PlainPrimaryUsernameValue(peer)
|
||||||
: PlainUsernameValue(peer) | rpl::type_erased()
|
: PlainUsernameValue(peer) | rpl::type_erased()
|
||||||
) | rpl::map([=](QString &&username) {
|
) | 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)),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,15 @@ rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
|
||||||
const QString &value);
|
const QString &value);
|
||||||
[[nodiscard]] rpl::producer<TextWithEntities> AboutValue(
|
[[nodiscard]] rpl::producer<TextWithEntities> AboutValue(
|
||||||
not_null<PeerData*> peer);
|
not_null<PeerData*> peer);
|
||||||
[[nodiscard]] rpl::producer<QString> LinkValue(
|
|
||||||
|
struct LinkWithUrl {
|
||||||
|
QString text;
|
||||||
|
QString url;
|
||||||
|
};
|
||||||
|
[[nodiscard]] rpl::producer<LinkWithUrl> LinkValue(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
bool primary = false);
|
bool primary = false);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<const ChannelLocation*> LocationValue(
|
[[nodiscard]] rpl::producer<const ChannelLocation*> LocationValue(
|
||||||
not_null<ChannelData*> channel);
|
not_null<ChannelData*> channel);
|
||||||
[[nodiscard]] rpl::producer<bool> NotificationsEnabledValue(
|
[[nodiscard]] rpl::producer<bool> NotificationsEnabledValue(
|
||||||
|
|
Loading…
Add table
Reference in a new issue