fix(MembersdSelectorView): fix the logic of opening CR popup (#11780)

This commit is contained in:
Igor Sirotin 2023-08-04 11:27:37 +03:00 committed by GitHub
parent edae7bf818
commit 129f81a01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 10 deletions

View File

@ -86,13 +86,6 @@ MembersSelectorBase {
}
function processContact(contactData) {
// Open contact request if we have data from url
if (contactData.publicKey !== "" && contactData.displayName !== "") {
Global.openContactRequestPopupWithContactData(contactData,
popup => popup.closed.connect(root.rejected))
return
}
const contactDetails = Utils.getContactDetailsAsJson(contactData.publicKey, false)
if (contactDetails.publicKey === "") {
// not a valid key given
@ -121,8 +114,18 @@ MembersSelectorBase {
if (root.model.count === 0 && !hasPendingContactRequest) {
// List is empty and not a contact yet. Open the contact request popup
Global.openContactRequestPopup(contactDetails.publicKey,
popup => popup.closed.connect(root.rejected))
// If `displayName` is not undefiend and not empty,
// then we open the popup with given `contactData`, which probably came from URL.
if (contactData.displayName) {
// Open contact request if we have data from url
Global.openContactRequestPopupWithContactData(contactData,
popup => popup.closed.connect(root.rejected))
} else {
Global.openContactRequestPopup(contactDetails.publicKey,
popup => popup.closed.connect(root.rejected))
}
return
}
@ -171,7 +174,7 @@ MembersSelectorBase {
root.suggestionsDialog.forceHide = false
return
}
d.processContact(resolvedPubKey)
d.processContact({publicKey: resolvedPubKey})
}
}
}