From f3021ec757bb1a6286e9f7ce9b6e9a5ad4afc0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Wed, 6 Nov 2024 21:53:41 +0100 Subject: [PATCH] Global signal related to contact popups simplified Global.openContactRequestPopup Global.openReviewContactRequestPopup Global.openNicknamePopupRequested Global.blockContactRequested/unblockContactRequested Global.openMarkAsUntrustedPopup Global.removeContactRequested Global.openMarkAsIDVerifiedPopup/openRemoveIDVerificationDialog --- .../AppLayouts/Chat/panels/UserListPanel.qml | 36 ++------- .../Chat/views/ChatMessagesView.qml | 2 +- .../Chat/views/MembersSelectorView.qml | 2 +- .../Communities/panels/MembersTabPanel.qml | 35 ++------- .../AppLayouts/Profile/views/ContactsView.qml | 35 ++------- ui/app/mainui/Popups.qml | 78 +++++++++++++------ .../ActivityNotificationContactRemoved.qml | 2 +- ui/imports/shared/views/ProfileDialogView.qml | 44 ++++------- ui/imports/shared/views/chat/MessageView.qml | 35 ++------- ui/imports/utils/Global.qml | 18 ++--- 10 files changed, 109 insertions(+), 178 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml index c779290412..31dfe1d0fd 100644 --- a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml @@ -176,39 +176,17 @@ Item { Global.changeAppSectionBySectionType(Constants.appSection.chat) root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") } - onReviewContactRequest: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) - } - onSendContactRequest: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.openContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) - } - onEditNickname: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - - Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null) - } + onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null) + onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null) + onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, null) onRemoveNickname: (displayName) => { root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true) } - onUnblockContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails) - } - onMarkAsUntrusted: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails) - } + onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey) + onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey) onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey) - onRemoveContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.removeContactRequested(profileContextMenu.publicKey, contactDetails) - } - onBlockContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.blockContactRequested(profileContextMenu.publicKey, contactDetails) - } + onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey) + onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey) onRemoveFromGroup: { root.store.removeMemberFromGroupChat(profileContextMenu.publicKey) } diff --git a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml index c041078eae..575ed4edab 100644 --- a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml @@ -409,7 +409,7 @@ Item { anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined text: qsTr("Send Contact Request") onClicked: { - Global.openContactRequestPopup(root.chatId, null, null) + Global.openContactRequestPopup(root.chatId, null) } } } diff --git a/ui/app/AppLayouts/Chat/views/MembersSelectorView.qml b/ui/app/AppLayouts/Chat/views/MembersSelectorView.qml index ccef6d4366..1a94869d01 100644 --- a/ui/app/AppLayouts/Chat/views/MembersSelectorView.qml +++ b/ui/app/AppLayouts/Chat/views/MembersSelectorView.qml @@ -114,7 +114,7 @@ MembersSelectorBase { if (root.model.count === 0 && !hasPendingContactRequest) { // List is empty and not a contact yet. Open the contact request popup - Global.openContactRequestPopup(contactDetails.publicKey, contactDetails, + Global.openContactRequestPopup(contactDetails.publicKey, popup => popup.closed.connect(root.rejected)) return } diff --git a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml index 8f3b652dba..8383499f4e 100644 --- a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml @@ -342,38 +342,17 @@ Item { Global.changeAppSectionBySectionType(Constants.appSection.chat) root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.publicKey, "") } - onReviewContactRequest: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, contactDetails, null) - } - onSendContactRequest: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.openContactRequestPopup(memberContextMenuView.publicKey, contactDetails, null) - } - onEditNickname: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.openNicknamePopupRequested(memberContextMenuView.publicKey, contactDetails, null) - } + onReviewContactRequest: Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, null) + onSendContactRequest: Global.openContactRequestPopup(memberContextMenuView.publicKey, null) + onEditNickname: Global.openNicknamePopupRequested(memberContextMenuView.publicKey, null) onRemoveNickname: (displayName) => { root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true) } - onUnblockContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.unblockContactRequested(memberContextMenuView.publicKey, contactDetails) - } - onMarkAsUntrusted: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.markAsUntrustedRequested(memberContextMenuView.publicKey, contactDetails) - } + onUnblockContact: Global.unblockContactRequested(memberContextMenuView.publicKey) + onMarkAsUntrusted: Global.markAsUntrustedRequested(memberContextMenuView.publicKey) onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.publicKey) - onRemoveContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.removeContactRequested(memberContextMenuView.publicKey, contactDetails) - } - onBlockContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) - Global.blockContactRequested(memberContextMenuView.publicKey, contactDetails) - } + onRemoveContact: Global.removeContactRequested(memberContextMenuView.publicKey) + onBlockContact: Global.blockContactRequested(memberContextMenuView.publicKey) onClosed: destroy() } } diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index 2598174823..89ca52755a 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -70,38 +70,17 @@ SettingsContentBase { onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.publicKey, null, null) onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.publicKey) - onReviewContactRequest: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.openReviewContactRequestPopup(contactContextMenu.publicKey, contactDetails, null) - } - onSendContactRequest: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.openContactRequestPopup(contactContextMenu.publicKey, contactDetails, null) - } - onEditNickname: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.openNicknamePopupRequested(contactContextMenu.publicKey, contactDetails, null) - } + onReviewContactRequest: Global.openReviewContactRequestPopup(contactContextMenu.publicKey, null) + onSendContactRequest: Global.openContactRequestPopup(contactContextMenu.publicKey, null) + onEditNickname: Global.openNicknamePopupRequested(contactContextMenu.publicKey, null) onRemoveNickname: (displayName) => { root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true) } - onUnblockContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.unblockContactRequested(contactContextMenu.publicKey, contactDetails) - } - onMarkAsUntrusted: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.markAsUntrustedRequested(contactContextMenu.publicKey, contactDetails) - } + onUnblockContact: Global.unblockContactRequested(contactContextMenu.publicKey) + onMarkAsUntrusted: Global.markAsUntrustedRequested(contactContextMenu.publicKey) onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.publicKey) - onRemoveContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.removeContactRequested(contactContextMenu.publicKey, contactDetails) - } - onBlockContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) - Global.blockContactRequested(contactContextMenu.publicKey, contactDetails) - } + onRemoveContact: Global.removeContactRequested(contactContextMenu.publicKey) + onBlockContact: Global.blockContactRequested(contactContextMenu.publicKey) onClosed: destroy() } } diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index d0a2cb14bf..79a7cff2bb 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -153,20 +153,36 @@ QtObject { openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup}, cb) } - function openNicknamePopup(publicKey: string, contactDetails, cb) { - openPopup(nicknamePopupComponent, {publicKey, contactDetails}, cb) + function openNicknamePopup(publicKey: string, cb) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(nicknamePopupComponent, properties, cb) } - function openMarkAsUntrustedPopup(publicKey: string, contactDetails) { - openPopup(markAsUntrustedComponent, {publicKey, contactDetails}) + function openMarkAsUntrustedPopup(publicKey: string) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(markAsUntrustedComponent, properties) } - function openBlockContactPopup(publicKey: string, contactDetails) { - openPopup(blockContactConfirmationComponent, {publicKey, contactDetails}) + function openBlockContactPopup(publicKey: string) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(blockContactConfirmationComponent, properties) } - function openUnblockContactPopup(publicKey: string, contactDetails) { - openPopup(unblockContactConfirmationComponent, {publicKey, contactDetails}) + function openUnblockContactPopup(publicKey: string) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(unblockContactConfirmationComponent, properties) } function openChangeProfilePicPopup(cb) { @@ -182,12 +198,20 @@ QtObject { openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule}) } - function openMarkAsIDVerifiedPopup(publicKey, contactDetails, cb) { - openPopup(markAsIDVerifiedPopupComponent, {publicKey, contactDetails}, cb) + function openMarkAsIDVerifiedPopup(publicKey, cb) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(markAsIDVerifiedPopupComponent, properties, cb) } - function openRemoveIDVerificationDialog(publicKey, contactDetails, cb) { - openPopup(removeIDVerificationPopupComponent, {publicKey, contactDetails}, cb) + function openRemoveIDVerificationDialog(publicKey, cb) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(removeIDVerificationPopupComponent, properties, cb) } function openInviteFriendsToCommunityPopup(community, communitySectionModule, cb) { @@ -202,23 +226,27 @@ QtObject { openPopup(inviteFriendsToCommunityPopup, { community: communityData, communitySectionModule: communitySectionModuleData }, cb) } - function openContactRequestPopup(publicKey, contactDetails, cb) { - let details = contactDetails ?? Utils.getContactDetailsAsJson(publicKey, false) - const popupProperties = { - publicKey: publicKey, - contactDetails: details - } - openPopup(sendContactRequestPopupComponent, popupProperties, cb) + function openContactRequestPopup(publicKey, cb) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(sendContactRequestPopupComponent, properties, cb) } - function openReviewContactRequestPopup(publicKey, contactDetails, cb) { + function openReviewContactRequestPopup(publicKey, cb) { try { const crDetails = rootStore.contactStore.getLatestContactRequestForContactAsJson(publicKey) if (crDetails.from !== publicKey) { console.warn("Popups.openReviewContactRequestPopup: not matching publicKey:", publicKey) return } - openPopup(reviewContactRequestPopupComponent, {publicKey, contactDetails, crDetails}, cb) + + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails, crDetails } + + openPopup(reviewContactRequestPopupComponent, properties, cb) } catch (e) { console.error("Popups.openReviewContactRequestPopup: error getting or parsing contact request data", e) } @@ -280,8 +308,12 @@ QtObject { openPopup(discordImportProgressDialog, {importingSingleChannel: importingSingleChannel}) } - function openRemoveContactConfirmationPopup(publicKey, contactDetails) { - openPopup(removeContactConfirmationDialog, {publicKey, contactDetails}) + function openRemoveContactConfirmationPopup(publicKey) { + const contactDetails = Utils.getContactDetailsAsJson( + publicKey, false, true, true) + const properties = { publicKey, contactDetails } + + openPopup(removeContactConfirmationDialog, properties) } function openDeleteMessagePopup(messageId, messageStore) { diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationContactRemoved.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationContactRemoved.qml index 8629cb694f..881122539f 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationContactRemoved.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationContactRemoved.qml @@ -49,6 +49,6 @@ ActivityNotificationMessage { enabled: root.contactDetails && !root.contactDetails.added && !root.contactDetails.isContactRequestReceived size: StatusBaseButton.Size.Small text: qsTr("Send Contact Request") - onClicked: Global.openContactRequestPopup(root.contactId, root.contactDetails, null) + onClicked: Global.openContactRequestPopup(root.contactId, null) } } diff --git a/ui/imports/shared/views/ProfileDialogView.qml b/ui/imports/shared/views/ProfileDialogView.qml index 6dff21b8e4..ca98f31700 100644 --- a/ui/imports/shared/views/ProfileDialogView.qml +++ b/ui/imports/shared/views/ProfileDialogView.qml @@ -129,7 +129,7 @@ Pane { objectName: "profileDialog_reviewContactRequestButton" size: StatusButton.Size.Small text: qsTr("Review contact request") - onClicked: Global.openReviewContactRequestPopup(root.publicKey, contactDetails, null) + onClicked: Global.openReviewContactRequestPopup(root.publicKey, null) } } @@ -139,7 +139,7 @@ Pane { objectName: "profileDialog_sendContactRequestButton" size: StatusButton.Size.Small text: qsTr("Send contact request") - onClicked: Global.openContactRequestPopup(root.publicKey, contactDetails, null) + onClicked: Global.openContactRequestPopup(root.publicKey, null) } } @@ -150,7 +150,7 @@ Pane { type: StatusBaseButton.Type.Danger objectName: "blockUserButton" text: qsTr("Block user") - onClicked: Global.blockContactRequested(root.publicKey, contactDetails) + onClicked: Global.blockContactRequested(root.publicKey) } } @@ -160,7 +160,7 @@ Pane { size: StatusButton.Size.Small objectName: "unblockUserProfileButton" text: qsTr("Unblock user") - onClicked: Global.unblockContactRequested(root.publicKey, contactDetails) + onClicked: Global.unblockContactRequested(root.publicKey) } } @@ -311,38 +311,30 @@ Pane { SendContactRequestMenuItem { enabled: !d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent && contactDetails.trustStatus === Constants.trustStatus.untrustworthy // we have an action button otherwise - onTriggered: { - Global.openContactRequestPopup(root.publicKey, contactDetails, null) - } + onTriggered: Global.openContactRequestPopup(root.publicKey, null) } StatusAction { text: qsTr("Mark as trusted") icon.name: "checkmark-circle" enabled: d.isContact && !d.isBlocked && !d.isLocallyTrusted - onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, contactDetails, null) + onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, null) } StatusAction { objectName: "addEditNickNameStatusAction" text: d.userNickName ? qsTr("Edit nickname") : qsTr("Add nickname") icon.name: "edit_pencil" - onTriggered: { - Global.openNicknamePopupRequested(root.publicKey, contactDetails, null) - } + onTriggered: Global.openNicknamePopupRequested(root.publicKey, null) } StatusAction { text: qsTr("Show QR code") icon.name: "qr" enabled: !d.isCurrentUser - onTriggered: { - Global.openPopup(shareProfileCmp) - } + onTriggered: Global.openPopup(shareProfileCmp) } StatusAction { text: qsTr("Copy link to profile") icon.name: "copy" - onTriggered: { - ClipboardUtils.setText(d.linkToProfile) - } + onTriggered: ClipboardUtils.setText(d.linkToProfile) } StatusMenuSeparator {} StatusAction { @@ -350,7 +342,7 @@ Pane { icon.name: "delete" type: StatusAction.Type.Danger enabled: d.isContact && d.isLocallyTrusted - onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, contactDetails, null) + onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, null) } StatusAction { text: qsTr("Remove nickname") @@ -365,27 +357,21 @@ Pane { icon.name: "warning" type: StatusAction.Type.Danger enabled: contactDetails.trustStatus !== Constants.trustStatus.untrustworthy && !d.isBlocked - onTriggered: { - Global.markAsUntrustedRequested(root.publicKey, contactDetails) - } + onTriggered: Global.markAsUntrustedRequested(root.publicKey) } StatusAction { text: qsTr("Remove untrusted mark") icon.name: "warning" type: StatusAction.Type.Danger enabled: contactDetails.trustStatus === Constants.trustStatus.untrustworthy && !d.isBlocked - onTriggered: { - root.contactsStore.removeTrustStatus(root.publicKey) - } + onTriggered: root.contactsStore.removeTrustStatus(root.publicKey) } StatusAction { text: qsTr("Remove contact") icon.name: "remove-contact" type: StatusAction.Type.Danger enabled: d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent - onTriggered: { - Global.removeContactRequested(root.publicKey, contactDetails) - } + onTriggered: Global.removeContactRequested(root.publicKey) } StatusAction { text: qsTr("Block user") @@ -393,9 +379,7 @@ Pane { icon.name: "cancel" type: StatusAction.Type.Danger enabled: !d.isBlocked - onTriggered: { - Global.blockContactRequested(root.publicKey, contactDetails) - } + onTriggered: Global.blockContactRequested(root.publicKey) } } } diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 413cb7de86..1cda7b5bb0 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -1193,38 +1193,17 @@ Loader { Global.changeAppSectionBySectionType(Constants.appSection.chat) root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") } - onReviewContactRequest: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) - } - onSendContactRequest: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.openContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) - } - onEditNickname: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null) - } + onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null) + onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null) + onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, null) onRemoveNickname: () => { root.rootStore.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", profileContextMenu.displayName, true) } - onUnblockContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails) - } - onMarkAsUntrusted: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails) - } + onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey) + onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey) onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.publicKey) - onRemoveContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.removeContactRequested(profileContextMenu.publicKey, contactDetails) - } - onBlockContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) - Global.blockContactRequested(profileContextMenu.publicKey, contactDetails) - } + onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey) + onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey) onRemoveFromGroup: () => { root.store.removeMemberFromGroupChat(profileContextMenu.publicKey) } diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index d5111d97b6..e1c8af3102 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -18,8 +18,8 @@ QtObject { signal openCreateChatView() signal closeCreateChatView() - signal blockContactRequested(string publicKey, var contactDetails) - signal unblockContactRequested(string publicKey, var contactDetails) + signal blockContactRequested(string publicKey) + signal unblockContactRequested(string publicKey) signal displayToastMessage(string title, string subTitle, string icon, bool loading, int ephNotifType, string url) signal displayToastWithActionMessage(string title, string subTitle, string icon, string iconColor, bool loading, int ephNotifType, int actionType, string data) @@ -27,7 +27,7 @@ QtObject { signal openPopupRequested(var popupComponent, var params) signal closePopupRequested() - signal openNicknamePopupRequested(string publicKey, var contactDetails, var cb) + signal openNicknamePopupRequested(string publicKey, var cb) signal openDownloadModalRequested(bool available, string version, string url) signal openChangeProfilePicPopup(var cb) signal openBackUpSeedPopup() @@ -35,12 +35,12 @@ QtObject { signal openVideoPopup(string url) signal openProfilePopupRequested(string publicKey, var parentPopup, var cb) signal openActivityCenterPopupRequested() - signal openMarkAsIDVerifiedPopup(string publicKey, var contactDetails, var cb) - signal openRemoveIDVerificationDialog(string publicKey, var contactDetails, var cb) - signal openContactRequestPopup(string publicKey, var contactDetails, var cb) - signal openReviewContactRequestPopup(string publicKey, var contactDetails, var cb) - signal markAsUntrustedRequested(string publicKey, var contactDetails) - signal removeContactRequested(string publicKey, var contactDetails) + signal openMarkAsIDVerifiedPopup(string publicKey, var cb) + signal openRemoveIDVerificationDialog(string publicKey, var cb) + signal openContactRequestPopup(string publicKey, var cb) + signal openReviewContactRequestPopup(string publicKey, var cb) + signal markAsUntrustedRequested(string publicKey) + signal removeContactRequested(string publicKey) signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb) signal openInviteFriendsToCommunityByIdPopup(string communityId, var cb) signal openDeleteMessagePopup(string messageId, var messageStore)