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
This commit is contained in:
Lukáš Tinkl 2024-11-04 22:47:59 +01:00 committed by Lukáš Tinkl
parent 22c4bb2846
commit 1c255175ab
10 changed files with 60 additions and 25 deletions

View File

@ -286,3 +286,4 @@ SplitView {
// category: Views // category: Views
// status: good // status: good
// https://www.figma.com/design/ibJOTPlNtIxESwS96vJb06/%F0%9F%91%A4-Profile-%7C-Desktop?node-id=7898-265693&node-type=canvas&m=dev

View File

@ -30,8 +30,10 @@ Item {
signal removeNicknameRequested(string pubKey) signal removeNicknameRequested(string pubKey)
signal blockContactRequested(string pubKey) signal blockContactRequested(string pubKey)
signal unblockContactRequested(string pubKey) signal unblockContactRequested(string pubKey)
signal markAsTrustedRequested(string pubKey)
signal markAsUntrustedRequested(string pubKey) signal markAsUntrustedRequested(string pubKey)
signal removeTrustStatusRequested(string pubKey) signal removeTrustStatusRequested(string pubKey)
signal removeTrustedMarkRequested(string pubKey)
signal removeContactRequested(string pubKey) signal removeContactRequested(string pubKey)
signal removeContactFromGroupRequested(string pubKey) signal removeContactFromGroupRequested(string pubKey)
@ -212,6 +214,8 @@ Item {
onRemoveContact: root.removeContactRequested(pubKey) onRemoveContact: root.removeContactRequested(pubKey)
onBlockContact: root.blockContactRequested(pubKey) onBlockContact: root.blockContactRequested(pubKey)
onRemoveFromGroup: root.removeContactFromGroupRequested(pubKey) onRemoveFromGroup: root.removeContactFromGroupRequested(pubKey)
onMarkAsTrusted: root.markAsTrustedRequested(pubKey)
onRemoveTrustedMark: root.removeTrustedMarkRequested(pubKey)
onClosed: destroy() onClosed: destroy()
} }

View File

@ -216,11 +216,14 @@ StatusSectionLayout {
onCreateOneToOneChatRequested: { onCreateOneToOneChatRequested: {
Global.changeAppSectionBySectionType(Constants.appSection.chat) Global.changeAppSectionBySectionType(Constants.appSection.chat)
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.pubKey, "") root.rootStore.chatCommunitySectionModule.createOneToOneChat("", pubKey, "")
} }
onRemoveTrustStatusRequested: root.contactsStore.removeTrustStatus(pubKey) onRemoveTrustStatusRequested: root.contactsStore.removeTrustStatus(pubKey)
onRemoveContactFromGroupRequested: root.rootStore.removeMemberFromGroupChat(pubKey) onRemoveContactFromGroupRequested: root.rootStore.removeMemberFromGroupChat(pubKey)
onMarkAsTrustedRequested: Global.openMarkAsIDVerifiedPopup(pubKey, null)
onRemoveTrustedMarkRequested: Global.openRemoveIDVerificationDialog(pubKey, null)
} }
} }

View File

@ -363,6 +363,8 @@ Item {
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.pubKey) onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.pubKey)
onRemoveContact: Global.removeContactRequested(memberContextMenuView.pubKey) onRemoveContact: Global.removeContactRequested(memberContextMenuView.pubKey)
onBlockContact: Global.blockContactRequested(memberContextMenuView.pubKey) onBlockContact: Global.blockContactRequested(memberContextMenuView.pubKey)
onMarkAsTrusted: Global.openMarkAsIDVerifiedPopup(memberContextMenuView.pubKey, null)
onRemoveTrustedMark: Global.openRemoveIDVerificationDialog(memberContextMenuView.pubKey, null)
onClosed: destroy() onClosed: destroy()
} }
} }

View File

@ -87,6 +87,8 @@ SettingsContentBase {
onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.pubKey) onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.pubKey)
onRemoveNickname: root.contactsStore.changeContactNickname(contactContextMenu.pubKey, "", onRemoveNickname: root.contactsStore.changeContactNickname(contactContextMenu.pubKey, "",
contactContextMenu.displayName, true) contactContextMenu.displayName, true)
onMarkAsTrusted: Global.openMarkAsIDVerifiedPopup(contactContextMenu.pubKey, null)
onRemoveTrustedMark: Global.openRemoveIDVerificationDialog(contactContextMenu.pubKey, null)
onClosed: destroy() onClosed: destroy()
} }
} }

View File

@ -333,7 +333,7 @@ SettingsContentBase {
inShowcaseModel: priv.showcaseModels.accountsVisibleModel inShowcaseModel: priv.showcaseModels.accountsVisibleModel
hiddenModel: priv.showcaseModels.accountsHiddenModel hiddenModel: priv.showcaseModels.accountsHiddenModel
showcaseLimit: root.profileStore.getProfileShowcaseEntriesLimit() showcaseLimit: root.profileStore.getProfileShowcaseEntriesLimit()
currentWallet: RootStore.overview.mixedcaseAddress currentWallet: WalletStores.RootStore.overview.mixedcaseAddress
onChangePositionRequested: function (from, to) { onChangePositionRequested: function (from, to) {
priv.showcaseModels.changeAccountPosition(from, to) priv.showcaseModels.changeAccountPosition(from, to)

View File

@ -200,7 +200,7 @@ QtObject {
function openMarkAsIDVerifiedPopup(publicKey, cb) { function openMarkAsIDVerifiedPopup(publicKey, cb) {
const contactDetails = Utils.getContactDetailsAsJson( const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true) publicKey, true, true, true)
const properties = { publicKey, contactDetails } const properties = { publicKey, contactDetails }
openPopup(markAsIDVerifiedPopupComponent, properties, cb) openPopup(markAsIDVerifiedPopupComponent, properties, cb)
@ -208,7 +208,7 @@ QtObject {
function openRemoveIDVerificationDialog(publicKey, cb) { function openRemoveIDVerificationDialog(publicKey, cb) {
const contactDetails = Utils.getContactDetailsAsJson( const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true) publicKey, true, true, true)
const properties = { publicKey, contactDetails } const properties = { publicKey, contactDetails }
openPopup(removeIDVerificationPopupComponent, properties, cb) openPopup(removeIDVerificationPopupComponent, properties, cb)

View File

@ -20,7 +20,7 @@ CommonContactDialog {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: Theme.halfPadding Layout.bottomMargin: Theme.halfPadding
wrapMode: Text.WordWrap 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 { StatusCheckBox {

View File

@ -1219,6 +1219,8 @@ Loader {
onRemoveContact: Global.removeContactRequested(profileContextMenu.pubKey) onRemoveContact: Global.removeContactRequested(profileContextMenu.pubKey)
onBlockContact: Global.blockContactRequested(profileContextMenu.pubKey) onBlockContact: Global.blockContactRequested(profileContextMenu.pubKey)
onRemoveFromGroup: root.store.removeMemberFromGroupChat(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) onOpened: root.setMessageActive(root.messageId, true)
onClosed: { onClosed: {

View File

@ -35,6 +35,8 @@ StatusMenu {
signal editNickname signal editNickname
signal removeNickname signal removeNickname
signal unblockContact signal unblockContact
signal markAsTrusted
signal removeTrustedMark
signal markAsUntrusted signal markAsUntrusted
signal removeTrustStatus signal removeTrustStatus
signal removeContact 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 // Send Message
SendMessageMenuItem { SendMessageMenuItem {
id: 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 // Send Contact Request
SendContactRequestMenuItem { SendContactRequestMenuItem {
id: sendContactRequestMenuItem id: sendContactRequestMenuItem
@ -116,6 +117,16 @@ StatusMenu {
onTriggered: root.sendContactRequest() 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 { StatusMenuSeparator {
topPadding: root.topPadding topPadding: root.topPadding
visible: root.profileType !== Constants.profileType.bridged && visible: root.profileType !== Constants.profileType.bridged &&
@ -132,6 +143,16 @@ StatusMenu {
onTriggered: root.removeNickname() 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 // Unblock User
StatusAction { StatusAction {
id: unblockAction id: unblockAction
@ -148,7 +169,7 @@ StatusMenu {
objectName: "removeFromGroup_StatusItem" objectName: "removeFromGroup_StatusItem"
icon.name: "remove-contact" icon.name: "remove-contact"
type: StatusAction.Type.Danger 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() onTriggered: root.removeFromGroup()
} }