mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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(
|
||||
_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
|
||||
|
|
|
@ -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
|
||||
? 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)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,15 @@ rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
|
|||
const QString &value);
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> AboutValue(
|
||||
not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<QString> LinkValue(
|
||||
|
||||
struct LinkWithUrl {
|
||||
QString text;
|
||||
QString url;
|
||||
};
|
||||
[[nodiscard]] rpl::producer<LinkWithUrl> LinkValue(
|
||||
not_null<PeerData*> peer,
|
||||
bool primary = false);
|
||||
|
||||
[[nodiscard]] rpl::producer<const ChannelLocation*> LocationValue(
|
||||
not_null<ChannelData*> channel);
|
||||
[[nodiscard]] rpl::producer<bool> NotificationsEnabledValue(
|
||||
|
|
Loading…
Add table
Reference in a new issue