Highlight primary usernames in profiles like the additional ones.

This commit is contained in:
John Preston 2022-11-21 16:53:52 +00:00
parent ab06574fd9
commit 2de76cb75b

View file

@ -372,13 +372,22 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
const auto usernameLine = addInfoOneLine( const auto usernameLine = addInfoOneLine(
UsernamesSubtext(_peer, tr::lng_info_username_label()), UsernamesSubtext(_peer, tr::lng_info_username_label()),
UsernameValue(user, true), UsernameValue(user, true) | rpl::map([=](TextWithEntities u) {
tr::lng_context_copy_mention(tr::now), return u.text.isEmpty()
? TextWithEntities()
: Ui::Text::Link(
u,
user->session().createInternalLinkFull(
u.text.mid(1)));
}),
QString(),
st::infoProfileLabeledUsernamePadding); st::infoProfileLabeledUsernamePadding);
usernameLine.subtext->overrideLinkClickHandler(UsernamesLinkCallback( const auto callback = UsernamesLinkCallback(
_peer, _peer,
Window::Show(controller), Window::Show(controller),
QString())); QString());
usernameLine.text->overrideLinkClickHandler(callback);
usernameLine.subtext->overrideLinkClickHandler(callback);
const auto usernameLabel = usernameLine.text; const auto usernameLabel = usernameLine.text;
if (user->isBot()) { if (user->isBot()) {
const auto copyUsername = Ui::CreateChild<Ui::IconButton>( const auto copyUsername = Ui::CreateChild<Ui::IconButton>(