mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Replaced plain username with link in peer short info box.
This commit is contained in:
@@ -809,7 +809,7 @@ void PeerShortInfoBox::prepareRows() {
|
||||
addInfoLine(std::move(label), aboutValue(), _st.labeled);
|
||||
addInfoOneLine(
|
||||
tr::lng_info_username_label(),
|
||||
usernameValue() | rpl::map(tr::marked),
|
||||
usernameValue(),
|
||||
tr::lng_context_copy_mention(tr::now));
|
||||
addInfoOneLine(
|
||||
birthdayLabel(),
|
||||
@@ -899,10 +899,12 @@ rpl::producer<QString> PeerShortInfoBox::phoneValue() const {
|
||||
}) | rpl::distinct_until_changed();
|
||||
}
|
||||
|
||||
rpl::producer<QString> PeerShortInfoBox::usernameValue() const {
|
||||
rpl::producer<TextWithEntities> PeerShortInfoBox::usernameValue() const {
|
||||
return _fields.value(
|
||||
) | rpl::map([](const PeerShortInfoFields &fields) {
|
||||
return fields.username;
|
||||
return fields.usernameLink.isEmpty()
|
||||
? TextWithEntities{ fields.username }
|
||||
: tr::link(fields.username, fields.usernameLink);
|
||||
}) | rpl::distinct_until_changed();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ struct PeerShortInfoFields {
|
||||
QString link;
|
||||
TextWithEntities about;
|
||||
QString username;
|
||||
QString usernameLink;
|
||||
Data::Birthday birthday;
|
||||
TextWithEntities note;
|
||||
bool isBio = false;
|
||||
@@ -185,7 +186,7 @@ private:
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> channelValue() const;
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> linkValue() const;
|
||||
[[nodiscard]] rpl::producer<QString> phoneValue() const;
|
||||
[[nodiscard]] rpl::producer<QString> usernameValue() const;
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> usernameValue() const;
|
||||
[[nodiscard]] rpl::producer<QString> birthdayLabel() const;
|
||||
[[nodiscard]] rpl::producer<QString> birthdayValue() const;
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> aboutValue() const;
|
||||
|
||||
@@ -237,6 +237,9 @@ void ProcessFullPhoto(
|
||||
.username = ((user && !username.isEmpty())
|
||||
? ('@' + username)
|
||||
: QString()),
|
||||
.usernameLink = ((user && !username.isEmpty())
|
||||
? Info::Profile::UsernameUrl(peer, username, true)
|
||||
: QString()),
|
||||
.birthday = user ? user->birthday() : Data::Birthday(),
|
||||
.note = user ? user->note() : TextWithEntities(),
|
||||
.isBio = (user && !user->isBot()),
|
||||
|
||||
Reference in New Issue
Block a user