fix(SendContactRequestModal): Display name / image problems with CR dialog
- fix missing profile image - fix displaying wrong name when a nickname or ENS name is present - fix ID verification flow ignoring nickname - fix empty results when a contact has only an alias name - fix needlessly requesting contact details several times (and overwriting it); we get this info already from Popups.qml - switch the popup to `StatusDialog` and fix hardcoded height Fixes #11726
This commit is contained in:
parent
3b560157be
commit
cdc5a90940
|
@ -27,6 +27,7 @@ import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
font.family: Theme.palette.baseFont.name
|
font.family: Theme.palette.baseFont.name
|
||||||
|
font.pixelSize: Theme.primaryTextFontSize
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.directColor1
|
||||||
linkColor: hoveredLink ? Qt.lighter(Theme.palette.primaryColor1)
|
linkColor: hoveredLink ? Qt.lighter(Theme.palette.primaryColor1)
|
||||||
: Theme.palette.primaryColor1
|
: Theme.palette.primaryColor1
|
||||||
|
|
|
@ -315,6 +315,7 @@ SettingsContentBase {
|
||||||
id: sendContactRequest
|
id: sendContactRequest
|
||||||
SendContactRequestModal {
|
SendContactRequestModal {
|
||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
|
onClosed: destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,13 +142,12 @@ QtObject {
|
||||||
|
|
||||||
function openSendIDRequestPopup(publicKey, cb) {
|
function openSendIDRequestPopup(publicKey, cb) {
|
||||||
const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
|
const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
|
||||||
|
const mainDisplayName = ProfileUtils.displayName(contactDetails.localNickname, contactDetails.name, contactDetails.displayName, contactDetails.alias)
|
||||||
openPopup(sendIDRequestPopupComponent, {
|
openPopup(sendIDRequestPopupComponent, {
|
||||||
userPublicKey: publicKey,
|
userPublicKey: publicKey,
|
||||||
userDisplayName: contactDetails.displayName,
|
contactDetails: contactDetails,
|
||||||
userIcon: contactDetails.largeImage,
|
title: qsTr("Verify %1's Identity").arg(mainDisplayName),
|
||||||
userIsEnsVerified: contactDetails.ensVerified,
|
challengeText: qsTr("Ask a question that only the real %1 will be able to answer e.g. a question about a shared experience, or ask %1 to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...).").arg(mainDisplayName),
|
||||||
"headerSettings.title": qsTr("Verify %1's Identity").arg(contactDetails.displayName),
|
|
||||||
challengeText: qsTr("Ask a question that only the real %1 will be able to answer e.g. a question about a shared experience, or ask %1 to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...).").arg(contactDetails.displayName),
|
|
||||||
buttonText: qsTr("Send verification request")
|
buttonText: qsTr("Send verification request")
|
||||||
}, cb)
|
}, cb)
|
||||||
}
|
}
|
||||||
|
@ -189,9 +188,7 @@ QtObject {
|
||||||
const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
|
const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
|
||||||
const popupProperties = {
|
const popupProperties = {
|
||||||
userPublicKey: publicKey,
|
userPublicKey: publicKey,
|
||||||
userDisplayName: contactDetails.displayName,
|
contactDetails: contactDetails
|
||||||
userIcon: contactDetails.largeImage,
|
|
||||||
userIsEnsVerified: contactDetails.ensVerified
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
||||||
|
@ -200,7 +197,7 @@ QtObject {
|
||||||
function openContactRequestPopupWithContactData(contactData, cb) {
|
function openContactRequestPopupWithContactData(contactData, cb) {
|
||||||
const popupProperties = {
|
const popupProperties = {
|
||||||
userPublicKey: contactData.publicKey,
|
userPublicKey: contactData.publicKey,
|
||||||
userDisplayName: contactData.displayName
|
contactDetails: { displayName: contactData.displayName }
|
||||||
}
|
}
|
||||||
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.14
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.14
|
import QtQuick.Layouts 1.15
|
||||||
|
import QtQml.Models 2.15
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.controls.chat 1.0
|
import shared.controls.chat 1.0
|
||||||
|
@ -9,17 +10,15 @@ import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Controls.Validators 0.1
|
import StatusQ.Controls.Validators 0.1
|
||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups.Dialog 0.1
|
||||||
|
|
||||||
StatusModal {
|
StatusDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var rootStore
|
property var rootStore
|
||||||
|
|
||||||
property string userPublicKey: ""
|
required property string userPublicKey
|
||||||
property string userDisplayName: ""
|
required property var contactDetails
|
||||||
property string userIcon: ""
|
|
||||||
property bool userIsEnsVerified
|
|
||||||
|
|
||||||
property string challengeText: qsTr("Say who you are / why you want to become a contact...")
|
property string challengeText: qsTr("Say who you are / why you want to become a contact...")
|
||||||
property string buttonText: qsTr("Send Contact Request")
|
property string buttonText: qsTr("Send Contact Request")
|
||||||
|
@ -27,31 +26,19 @@ StatusModal {
|
||||||
signal accepted(string message)
|
signal accepted(string message)
|
||||||
|
|
||||||
width: 480
|
width: 480
|
||||||
height: 548
|
horizontalPadding: Style.current.padding
|
||||||
|
verticalPadding: Style.current.bigPadding
|
||||||
|
|
||||||
headerSettings.title: d.loadingContactDetails ? qsTr("Send Contact Request")
|
title: qsTr("Send Contact Request to %1").arg(d.mainDisplayName)
|
||||||
: qsTr("Send Contact Request to %1").arg(d.userDisplayName)
|
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
messageInput.input.edit.forceActiveFocus()
|
messageInput.input.edit.forceActiveFocus()
|
||||||
|
|
||||||
if (userDisplayName !== "" && userPublicKey !== "") {
|
// (request) update from mailserver
|
||||||
d.updateContactDetails({
|
if (d.userDisplayName === "") {
|
||||||
displayName: userDisplayName,
|
root.rootStore.contactStore.requestContactInfo(root.userPublicKey)
|
||||||
largeImage: "",
|
d.loadingContactDetails = true
|
||||||
userIsEnsVerified: false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const contactDetails = Utils.getContactDetailsAsJson(userPublicKey, false)
|
|
||||||
|
|
||||||
if (contactDetails.displayName !== "") {
|
|
||||||
d.updateContactDetails(contactDetails)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
root.rootStore.contactStore.requestContactInfo(root.userPublicKey)
|
|
||||||
d.loadingContactDetails = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -64,47 +51,39 @@ StatusModal {
|
||||||
|
|
||||||
property bool loadingContactDetails: false
|
property bool loadingContactDetails: false
|
||||||
|
|
||||||
property string userDisplayName: ""
|
property var contactDetails: root.contactDetails
|
||||||
property string userIcon: ""
|
|
||||||
property bool userIsEnsVerified
|
|
||||||
|
|
||||||
function updateContactDetails(contactDetails) {
|
readonly property bool userIsEnsVerified: contactDetails.ensVerified
|
||||||
d.userDisplayName = contactDetails.displayName
|
readonly property string userDisplayName: contactDetails.displayName
|
||||||
d.userIcon = contactDetails.largeImage
|
readonly property string userNickName: contactDetails.localNickname
|
||||||
d.userIsEnsVerified = contactDetails.ensVerified
|
readonly property string prettyEnsName: contactDetails.name
|
||||||
}
|
readonly property string aliasName: contactDetails.alias
|
||||||
|
readonly property string mainDisplayName: ProfileUtils.displayName(userNickName, prettyEnsName, userDisplayName, aliasName)
|
||||||
|
readonly property var userIcon: contactDetails.largeImage
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.rootStore.contactStore.contactsModule
|
target: root.rootStore.contactStore.contactsModule
|
||||||
|
|
||||||
function onContactInfoRequestFinished(publicKey, ok) {
|
function onContactInfoRequestFinished(publicKey, ok) {
|
||||||
if (ok) {
|
if (ok && publicKey === root.userPublicKey) {
|
||||||
const details = Utils.getContactDetailsAsJson(userPublicKey, false)
|
d.contactDetails = Utils.getContactDetailsAsJson(userPublicKey, false)
|
||||||
d.updateContactDetails(details)
|
|
||||||
}
|
}
|
||||||
d.loadingContactDetails = false
|
d.loadingContactDetails = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
id: content
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: Style.current.bigPadding
|
|
||||||
anchors.leftMargin: Style.current.padding
|
|
||||||
anchors.rightMargin: Style.current.padding
|
|
||||||
spacing: d.contentSpacing
|
spacing: d.contentSpacing
|
||||||
|
|
||||||
ProfileHeader {
|
ProfileHeader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
displayName: d.mainDisplayName
|
||||||
displayName: d.userDisplayName
|
|
||||||
pubkey: root.userPublicKey
|
pubkey: root.userPublicKey
|
||||||
icon: d.userIcon
|
icon: d.userIcon
|
||||||
userIsEnsVerified: d.userIsEnsVerified
|
userIsEnsVerified: d.userIsEnsVerified
|
||||||
|
isContact: d.contactDetails.isContact
|
||||||
displayNameVisible: true
|
trustStatus: d.contactDetails.trustStatus
|
||||||
pubkeyVisible: true
|
|
||||||
imageSize: ProfileHeader.ImageSize.Middle
|
imageSize: ProfileHeader.ImageSize.Middle
|
||||||
loading: d.loadingContactDetails
|
loading: d.loadingContactDetails
|
||||||
}
|
}
|
||||||
|
@ -126,13 +105,17 @@ StatusModal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rightButtons: StatusButton {
|
footer: StatusDialogFooter {
|
||||||
objectName: "ProfileSendContactRequestModal_sendContactRequestButton"
|
rightButtons: ObjectModel {
|
||||||
enabled: messageInput.valid
|
StatusButton {
|
||||||
text: root.buttonText
|
objectName: "ProfileSendContactRequestModal_sendContactRequestButton"
|
||||||
onClicked: {
|
enabled: messageInput.valid
|
||||||
root.accepted(messageInput.text);
|
text: root.buttonText
|
||||||
root.close();
|
onClicked: {
|
||||||
|
root.accepted(messageInput.text);
|
||||||
|
root.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue