From 1c255175abb78b3cb93f2e3588914df85e5f4fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Mon, 4 Nov 2024 22:47:59 +0100 Subject: [PATCH] feat(ProfileContextMenu): Add "Mark as Trusted" and "Remove trusted mark" - enhance and fix the SB page to be able to show all the permutations, including profile image, emoji hash and ring Fixes #16586 --- storybook/pages/ProfileContextMenuPage.qml | 1 + .../AppLayouts/Chat/panels/UserListPanel.qml | 4 ++ ui/app/AppLayouts/Chat/views/ChatView.qml | 5 +- .../Communities/panels/MembersTabPanel.qml | 2 + .../AppLayouts/Profile/views/ContactsView.qml | 2 + .../Profile/views/MyProfileView.qml | 2 +- ui/app/mainui/Popups.qml | 4 +- .../popups/RemoveIDVerificationDialog.qml | 2 +- ui/imports/shared/views/chat/MessageView.qml | 2 + .../shared/views/chat/ProfileContextMenu.qml | 61 +++++++++++++------ 10 files changed, 60 insertions(+), 25 deletions(-) diff --git a/storybook/pages/ProfileContextMenuPage.qml b/storybook/pages/ProfileContextMenuPage.qml index eabac868f1..f62eb90e37 100644 --- a/storybook/pages/ProfileContextMenuPage.qml +++ b/storybook/pages/ProfileContextMenuPage.qml @@ -286,3 +286,4 @@ SplitView { // category: Views // status: good +// https://www.figma.com/design/ibJOTPlNtIxESwS96vJb06/%F0%9F%91%A4-Profile-%7C-Desktop?node-id=7898-265693&node-type=canvas&m=dev diff --git a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml index 047de9255a..e69e46648c 100644 --- a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml @@ -30,8 +30,10 @@ Item { signal removeNicknameRequested(string pubKey) signal blockContactRequested(string pubKey) signal unblockContactRequested(string pubKey) + signal markAsTrustedRequested(string pubKey) signal markAsUntrustedRequested(string pubKey) signal removeTrustStatusRequested(string pubKey) + signal removeTrustedMarkRequested(string pubKey) signal removeContactRequested(string pubKey) signal removeContactFromGroupRequested(string pubKey) @@ -212,6 +214,8 @@ Item { onRemoveContact: root.removeContactRequested(pubKey) onBlockContact: root.blockContactRequested(pubKey) onRemoveFromGroup: root.removeContactFromGroupRequested(pubKey) + onMarkAsTrusted: root.markAsTrustedRequested(pubKey) + onRemoveTrustedMark: root.removeTrustedMarkRequested(pubKey) onClosed: destroy() } diff --git a/ui/app/AppLayouts/Chat/views/ChatView.qml b/ui/app/AppLayouts/Chat/views/ChatView.qml index 9a7561d6e7..ad3925297d 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -216,11 +216,14 @@ StatusSectionLayout { onCreateOneToOneChatRequested: { Global.changeAppSectionBySectionType(Constants.appSection.chat) - root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.pubKey, "") + root.rootStore.chatCommunitySectionModule.createOneToOneChat("", pubKey, "") } onRemoveTrustStatusRequested: root.contactsStore.removeTrustStatus(pubKey) onRemoveContactFromGroupRequested: root.rootStore.removeMemberFromGroupChat(pubKey) + + onMarkAsTrustedRequested: Global.openMarkAsIDVerifiedPopup(pubKey, null) + onRemoveTrustedMarkRequested: Global.openRemoveIDVerificationDialog(pubKey, null) } } diff --git a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml index 0fc7511e24..cc13e215d6 100644 --- a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml @@ -363,6 +363,8 @@ Item { onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.pubKey) onRemoveContact: Global.removeContactRequested(memberContextMenuView.pubKey) onBlockContact: Global.blockContactRequested(memberContextMenuView.pubKey) + onMarkAsTrusted: Global.openMarkAsIDVerifiedPopup(memberContextMenuView.pubKey, null) + onRemoveTrustedMark: Global.openRemoveIDVerificationDialog(memberContextMenuView.pubKey, null) onClosed: destroy() } } diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index d00badd526..64ab696749 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -87,6 +87,8 @@ SettingsContentBase { onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.pubKey) onRemoveNickname: root.contactsStore.changeContactNickname(contactContextMenu.pubKey, "", contactContextMenu.displayName, true) + onMarkAsTrusted: Global.openMarkAsIDVerifiedPopup(contactContextMenu.pubKey, null) + onRemoveTrustedMark: Global.openRemoveIDVerificationDialog(contactContextMenu.pubKey, null) onClosed: destroy() } } diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 3e0db18dff..b6fe94c080 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -333,7 +333,7 @@ SettingsContentBase { inShowcaseModel: priv.showcaseModels.accountsVisibleModel hiddenModel: priv.showcaseModels.accountsHiddenModel showcaseLimit: root.profileStore.getProfileShowcaseEntriesLimit() - currentWallet: RootStore.overview.mixedcaseAddress + currentWallet: WalletStores.RootStore.overview.mixedcaseAddress onChangePositionRequested: function (from, to) { priv.showcaseModels.changeAccountPosition(from, to) diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index 79a7cff2bb..b584b130a3 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -200,7 +200,7 @@ QtObject { function openMarkAsIDVerifiedPopup(publicKey, cb) { const contactDetails = Utils.getContactDetailsAsJson( - publicKey, false, true, true) + publicKey, true, true, true) const properties = { publicKey, contactDetails } openPopup(markAsIDVerifiedPopupComponent, properties, cb) @@ -208,7 +208,7 @@ QtObject { function openRemoveIDVerificationDialog(publicKey, cb) { const contactDetails = Utils.getContactDetailsAsJson( - publicKey, false, true, true) + publicKey, true, true, true) const properties = { publicKey, contactDetails } openPopup(removeIDVerificationPopupComponent, properties, cb) diff --git a/ui/imports/shared/popups/RemoveIDVerificationDialog.qml b/ui/imports/shared/popups/RemoveIDVerificationDialog.qml index 4536dfc33e..ab4685faa6 100644 --- a/ui/imports/shared/popups/RemoveIDVerificationDialog.qml +++ b/ui/imports/shared/popups/RemoveIDVerificationDialog.qml @@ -20,7 +20,7 @@ CommonContactDialog { Layout.fillWidth: true Layout.bottomMargin: Theme.halfPadding wrapMode: Text.WordWrap - text: qsTr("%1's identity will no longer be verified. This is only visible to you.").arg(mainDisplayName) + text: qsTr("%1 will no longer be marked as trusted. This is only visible to you.").arg(mainDisplayName) } StatusCheckBox { diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 606b2695da..e668c15076 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -1219,6 +1219,8 @@ Loader { onRemoveContact: Global.removeContactRequested(profileContextMenu.pubKey) onBlockContact: Global.blockContactRequested(profileContextMenu.pubKey) onRemoveFromGroup: root.store.removeMemberFromGroupChat(profileContextMenu.pubKey) + onMarkAsTrusted: Global.openMarkAsIDVerifiedPopup(profileContextMenu.pubKey, null) + onRemoveTrustedMark: Global.openRemoveIDVerificationDialog(profileContextMenu.pubKey, null) onOpened: root.setMessageActive(root.messageId, true) onClosed: { diff --git a/ui/imports/shared/views/chat/ProfileContextMenu.qml b/ui/imports/shared/views/chat/ProfileContextMenu.qml index a5c45b42e3..89ab44019a 100644 --- a/ui/imports/shared/views/chat/ProfileContextMenu.qml +++ b/ui/imports/shared/views/chat/ProfileContextMenu.qml @@ -35,6 +35,8 @@ StatusMenu { signal editNickname signal removeNickname signal unblockContact + signal markAsTrusted + signal removeTrustedMark signal markAsUntrusted signal removeTrustStatus signal removeContact @@ -78,25 +80,6 @@ StatusMenu { } } - // Edit Nickname - StatusAction { - id: renameAction - objectName: "rename_StatusItem" - enabled: root.profileType === Constants.profileType.blocked || root.profileType === Constants.profileType.regular - text: root.hasLocalNickname ? qsTr("Edit nickname") : qsTr("Add nickname") - icon.name: "edit_pencil" - onTriggered: root.editNickname() - } - - // Review Contact Request - StatusAction { - text: qsTr("Review contact request") - objectName: "reviewContactRequest_StatusItem" - icon.name: "add-contact" - enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contactRequestReceived - onTriggered: root.reviewContactRequest() - } - // Send Message SendMessageMenuItem { id: sendMessageMenuItem @@ -108,6 +91,24 @@ StatusMenu { } } + // Mark as trusted + StatusAction { + objectName: "markAsTrusted_StatusItem" + enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contact && root.trustStatus !== Constants.trustStatus.trusted + text: qsTr("Mark as trusted") + icon.name: "checkmark-circle" + onTriggered: root.markAsTrusted() + } + + // Review Contact Request + StatusAction { + text: qsTr("Review contact request") + objectName: "reviewContactRequest_StatusItem" + icon.name: "add-contact" + enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contactRequestReceived + onTriggered: root.reviewContactRequest() + } + // Send Contact Request SendContactRequestMenuItem { id: sendContactRequestMenuItem @@ -116,6 +117,16 @@ StatusMenu { onTriggered: root.sendContactRequest() } + // Edit Nickname + StatusAction { + id: renameAction + objectName: "rename_StatusItem" + enabled: root.profileType === Constants.profileType.blocked || root.profileType === Constants.profileType.regular + text: root.hasLocalNickname ? qsTr("Edit nickname") : qsTr("Add nickname") + icon.name: "edit_pencil" + onTriggered: root.editNickname() + } + StatusMenuSeparator { topPadding: root.topPadding visible: root.profileType !== Constants.profileType.bridged && @@ -132,6 +143,16 @@ StatusMenu { onTriggered: root.removeNickname() } + // Remove trusted mark + StatusAction { + objectName: "removeTrustedMark_StatusItem" + enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contact && root.trustStatus === Constants.trustStatus.trusted + text: qsTr("Remove trusted mark") + icon.name: "checkmark-circle" + type: StatusAction.Type.Danger + onTriggered: root.removeTrustedMark() + } + // Unblock User StatusAction { id: unblockAction @@ -148,7 +169,7 @@ StatusMenu { objectName: "removeFromGroup_StatusItem" icon.name: "remove-contact" type: StatusAction.Type.Danger - enabled: root.isAdmin && root.profileType !== Constants.profileType.self && root.chatType === Constants.chatType.privateGroupChat + enabled: root.isAdmin && root.profileType !== Constants.profileType.self && root.profileType !== Constants.profileType.bridged && root.chatType === Constants.chatType.privateGroupChat onTriggered: root.removeFromGroup() }