Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ProfileContextMenu): Add "Mark as Trusted" and "Remove trusted mark" #16714

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
410 changes: 162 additions & 248 deletions storybook/pages/ProfileContextMenuPage.qml

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion ui/app/AppLayouts/Chat/panels/UserListPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Item {
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null)
}
onRemoveNickname: (displayName) => {
onRemoveNickname: {
root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true)
}
onUnblockContact: {
Expand All @@ -209,6 +209,15 @@ Item {
onRemoveFromGroup: {
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
}
onMarkAsTrusted: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openMarkAsIDVerifiedPopup(publicKey, contactDetails, null)
}
onRemoveTrustedMark: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openRemoveIDVerificationDialog(publicKey, contactDetails, null)
}

onClosed: destroy()
}
}
Expand Down
10 changes: 9 additions & 1 deletion ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Item {
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true)
Global.openNicknamePopupRequested(memberContextMenuView.publicKey, contactDetails, null)
}
onRemoveNickname: (displayName) => {
onRemoveNickname: {
root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true)
}
onUnblockContact: {
Expand All @@ -373,6 +373,14 @@ Item {
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true)
Global.blockContactRequested(memberContextMenuView.publicKey, contactDetails)
}
onMarkAsTrusted: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openMarkAsIDVerifiedPopup(publicKey, contactDetails, null)
}
onRemoveTrustedMark: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openRemoveIDVerificationDialog(publicKey, contactDetails, null)
}
onClosed: destroy()
}
}
Expand Down
12 changes: 10 additions & 2 deletions ui/app/AppLayouts/Profile/views/ContactsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ SettingsContentBase {
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true)
Global.openNicknamePopupRequested(contactContextMenu.publicKey, contactDetails, null)
}
onRemoveNickname: (displayName) => {
onRemoveNickname: {
root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true)
}
onUnblockContact: () => {
Expand All @@ -94,6 +94,14 @@ SettingsContentBase {
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true)
Global.blockContactRequested(contactContextMenu.publicKey, contactDetails)
}
onMarkAsTrusted: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openMarkAsIDVerifiedPopup(publicKey, contactDetails, null)
}
onRemoveTrustedMark: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openRemoveIDVerificationDialog(publicKey, contactDetails, null)
}
onClosed: destroy()
}
}
Expand Down Expand Up @@ -124,7 +132,7 @@ SettingsContentBase {
enabled: root.contactsStore.receivedContactRequestsModel.count > 0 ||
root.contactsStore.sentContactRequestsModel.count > 0
text: qsTr("Pending Requests")
badge.value: root.contactsStore.receivedContactRequestsModel.count
badge.value: root.contactsStore.receivedContactRequestsModel.count + root.contactsStore.sentContactRequestsModel.count
}
StatusTabButton {
id: blockedBtn
Expand Down
2 changes: 1 addition & 1 deletion ui/imports/shared/popups/RemoveIDVerificationDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 trusted. This is only visible to you.").arg(mainDisplayName)
}

StatusCheckBox {
Expand Down
8 changes: 8 additions & 0 deletions ui/imports/shared/views/chat/MessageView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,14 @@ Loader {
onRemoveFromGroup: () => {
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
}
onMarkAsTrusted: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openMarkAsIDVerifiedPopup(publicKey, contactDetails, null)
}
onRemoveTrustedMark: {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.openRemoveIDVerificationDialog(publicKey, contactDetails, null)
}
onOpened: root.setMessageActive(root.messageId, true)
onClosed: {
root.setMessageActive(root.messageId, false)
Expand Down
61 changes: 41 additions & 20 deletions ui/imports/shared/views/chat/ProfileContextMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ StatusMenu {
signal reviewContactRequest
signal sendContactRequest
signal editNickname
signal removeNickname(string displayName)
signal removeNickname
signal unblockContact
signal markAsTrusted
signal removeTrustedMark
signal markAsUntrusted
signal removeTrustStatus
signal removeContact
Expand Down Expand Up @@ -73,14 +75,24 @@ StatusMenu {
}
}

// Edit Nickname
// Send Message
SendMessageMenuItem {
id: sendMessageMenuItem
objectName: "sendMessage_StatusItem"
enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contact
onTriggered: {
root.createOneToOneChat()
root.close()
}
}

// Mark as trusted
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()
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
Expand All @@ -92,17 +104,6 @@ StatusMenu {
onTriggered: root.reviewContactRequest()
}

// Send Message
SendMessageMenuItem {
id: sendMessageMenuItem
objectName: "sendMessage_StatusItem"
enabled: root.profileType === Constants.profileType.regular && root.contactType === Constants.contactType.contact
onTriggered: {
root.createOneToOneChat()
root.close()
}
}

// Send Contact Request
SendContactRequestMenuItem {
id: sendContactRequestMenuItem
Expand All @@ -111,6 +112,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 &&
Expand All @@ -124,7 +135,17 @@ StatusMenu {
icon.name: "delete"
type: StatusAction.Type.Danger
enabled: (root.profileType === Constants.profileType.blocked || root.profileType === Constants.profileType.regular) && root.hasLocalNickname
onTriggered: root.removeNickname(root.displayName)
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
Expand Down