diff --git a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml index a426122e34..b625f56de8 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml @@ -212,6 +212,7 @@ Item { messageContextMenu.emojiOnly = emojiOnly; messageContextMenu.hideEmojiPicker = hideEmojiPicker; messageContextMenu.pinnedMessage = pinnedMessage; + messageContextMenu.isCurrentUser = isCurrentUser; messageContextMenu.show(userName, fromAuthor, root.profileImageSource || identicon, plainText, nickname, emojiReactionsModel); // Position the center of the menu where the mouse is if (messageContextMenu.x + messageContextMenu.width + Style.current.padding < root.width) { diff --git a/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml b/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml index 0ade110408..41ba8d24f1 100644 --- a/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml +++ b/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml @@ -112,7 +112,7 @@ PopupMenu { StyledText { id: username - text: Utils.removeStatusEns(userName) + text: Utils.removeStatusEns(isCurrentUser ? profileModel.ens.preferredUsername || userName : userName) elide: Text.ElideRight maximumLineCount: 3 horizontalAlignment: Text.AlignHCenter diff --git a/ui/app/AppLayouts/Chat/components/ProfilePopup.qml b/ui/app/AppLayouts/Chat/components/ProfilePopup.qml index 60a900a499..9da4d6219b 100644 --- a/ui/app/AppLayouts/Chat/components/ProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/components/ProfilePopup.qml @@ -24,6 +24,7 @@ ModalPopup { property bool isEnsVerified: false property bool noFooter: false property bool isBlocked: false + property bool isCurrentUser: false signal blockButtonClicked(name: string, address: string) signal unblockButtonClicked(name: string, address: string) @@ -46,7 +47,7 @@ ModalPopup { isEnsVerified = chatsModel.ensView.isEnsVerified(this.fromAuthor) isBlocked = profileModel.contacts.isContactBlocked(this.fromAuthor); alias = chatsModel.alias(this.fromAuthor) || "" - + isCurrentUser = profileModel.profile.pubKey === this.fromAuthor noFooter = !showFooter; popup.open() } @@ -67,7 +68,7 @@ ModalPopup { StyledText { id: profileName - text: Utils.removeStatusEns(userName) + text: Utils.removeStatusEns(isCurrentUser ? profileModel.ens.preferredUsername || userName : userName) elide: Text.ElideRight anchors.top: parent.top anchors.topMargin: Style.current.padding @@ -137,9 +138,9 @@ ModalPopup { id: ensText //% "ENS username" label: qsTrId("ens-username") - text: userName + text: isCurrentUser ? profileModel.ens.preferredUsername || userName : userName anchors.top: parent.top - visible: isEnsVerified + visible: isEnsVerified || profileModel.ens.preferredUsername !== "" height: visible ? implicitHeight : 0 textToCopy: userName } @@ -187,10 +188,36 @@ ModalPopup { id: valueShareURL //% "Share Profile URL" label: qsTrId("share-profile-url") - text: Constants.userLinkPrefix + fromAuthor.substr(0, 4) + "..." + fromAuthor.substr(fromAuthor.length - 5) + text: { + let user = "" + if (isCurrentUser) { + user = profileModel.ens.preferredUsername + } else { + if (isEnsVerified) { + user = userName.startsWith("@") ? userName.substring(1) : userName + } + } + if (user === ""){ + user = fromAuthor.substr(0, 4) + "..." + fromAuthor.substr(fromAuthor.length - 5) + } + return Constants.userLinkPrefix + user; + } anchors.top: separator.top anchors.topMargin: popup.innerMargin - textToCopy: Constants.userLinkPrefix + fromAuthor + textToCopy: { + let user = "" + if (isCurrentUser) { + user = profileModel.ens.preferredUsername + } else { + if (isEnsVerified) { + user = userName.startsWith("@") ? userName.substring(1) : userName + } + } + if (user === ""){ + user = fromAuthor + } + return Constants.userLinkPrefix + user; + } } Separator { diff --git a/ui/app/AppLayouts/Profile/Sections/MyProfileContainer.qml b/ui/app/AppLayouts/Profile/Sections/MyProfileContainer.qml index 8d6f969035..6441609409 100644 --- a/ui/app/AppLayouts/Profile/Sections/MyProfileContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/MyProfileContainer.qml @@ -6,7 +6,7 @@ import "../../../../shared" import "../../../../shared/status" Item { - property string ensName: profileModel.profile.preferredUsername || "" + property string ensName: profileModel.ens.preferredUsername || "" property string username: profileModel.profile.username property string pubkey: profileModel.profile.pubKey @@ -146,8 +146,8 @@ Item { TextWithLabel { //% "Share Profile URL" label: qsTrId("share-profile-url") - text: `${Constants.userLinkPrefix}${pubkey.substring(0, 5)}...${pubkey.substring(pubkey.length - 5)}` - textToCopy: Constants.userLinkPrefix + pubkey + text: `${Constants.userLinkPrefix}${ensName !== "" ? ensName : (pubkey.substring(0, 5) + "..." + pubkey.substring(pubkey.length - 5))}` + textToCopy: Constants.userLinkPrefix + (ensName !== "" ? ensName : pubkey) } } }