fix(@desktop/ProfilePopup) [base_bc] share profile url in profile modal is incorrect

Closes #4419

profileStore property has been added based in MyProfileView.qml.

Share profile information has been updated using the new store.

It also fixes another issue related to Contact/ViewProfile/ShareProfileURL. It was also showing incorrect info.
This commit is contained in:
Noelia 2022-01-17 15:56:19 +01:00 committed by Sale Djenic
parent aa5cb2446e
commit ddfa3d3e4e
2 changed files with 12 additions and 15 deletions

View File

@ -138,6 +138,7 @@ Item {
property Component profilePopupComponent: ProfilePopup { property Component profilePopupComponent: ProfilePopup {
id: profilePopup id: profilePopup
profileStore: appMain.rootStore.profileSectionStore.profileStore
contactsStore: appMain.rootStore.profileSectionStore.contactsStore contactsStore: appMain.rootStore.profileSectionStore.contactsStore
onClosed: { onClosed: {
if (profilePopup.parentPopup) { if (profilePopup.parentPopup) {

View File

@ -20,6 +20,7 @@ StatusModal {
property Popup parentPopup property Popup parentPopup
property var profileStore
property var contactsStore property var contactsStore
property string userPublicKey: "" property string userPublicKey: ""
@ -60,7 +61,7 @@ StatusModal {
isAddedContact = contactDetails.isContact isAddedContact = contactDetails.isContact
text = "" // this is most likely unneeded text = "" // this is most likely unneeded
isCurrentUser = userProfile.pubKey === publicKey isCurrentUser = popup.profileStore.pubkey === publicKey
showFooter = !isCurrentUser showFooter = !isCurrentUser
popup.open() popup.open()
} }
@ -137,14 +138,15 @@ StatusModal {
StatusDescriptionListItem { StatusDescriptionListItem {
title: qsTr("Share Profile URL") title: qsTr("Share Profile URL")
subTitle: { subTitle: {
let user = "" let user = ""
if (isCurrentUser) { if (isCurrentUser) {
user = userProfile.name user = popup.profileStore.ensName !== "" ? popup.profileStore.ensName :
} else { (popup.profileStore.pubkey.substring(0, 5) + "..." + popup.profileStore.pubkey.substring(popup.profileStore.pubkey.length - 5))
if (userIsEnsVerified) { } else if (userIsEnsVerified) {
user = userEnsName user = userEnsName
}
} }
if (user === ""){ if (user === ""){
user = userPublicKey.substr(0, 4) + "..." + userPublicKey.substr(userPublicKey.length - 5) user = userPublicKey.substr(0, 4) + "..." + userPublicKey.substr(userPublicKey.length - 5)
} }
@ -155,17 +157,11 @@ StatusModal {
iconButton.onClicked: { iconButton.onClicked: {
let user = "" let user = ""
if (isCurrentUser) { if (isCurrentUser) {
user = userProfile.name user = popup.profileStore.ensName !== "" ? popup.profileStore.ensName : popup.profileStore.pubkey
} else { } else {
if (userIsEnsVerified) { user = (userEnsName !== "" ? userEnsName : userPublicKey)
user = userName.startsWith("@") ? userName.substring(1) : userName
}
} }
if (user === ""){ popup.profileStore.copyToClipboard(Constants.userLinkPrefix + user)
user = userPublicKey
}
globalUtils.copyToClipboard(subTitle)
tooltip.visible = !tooltip.visible tooltip.visible = !tooltip.visible
} }
width: parent.width width: parent.width