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 {
id: profilePopup
profileStore: appMain.rootStore.profileSectionStore.profileStore
contactsStore: appMain.rootStore.profileSectionStore.contactsStore
onClosed: {
if (profilePopup.parentPopup) {

View File

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