Global signal related to contact popups simplified

Global.openContactRequestPopup
Global.openReviewContactRequestPopup
Global.openNicknamePopupRequested
Global.blockContactRequested/unblockContactRequested
Global.openMarkAsUntrustedPopup
Global.removeContactRequested
Global.openMarkAsIDVerifiedPopup/openRemoveIDVerificationDialog
This commit is contained in:
Michał Cieślak 2024-11-06 21:53:41 +01:00 committed by Michał
parent b8f9566116
commit f3021ec757
10 changed files with 109 additions and 178 deletions

View File

@ -176,39 +176,17 @@ Item {
Global.changeAppSectionBySectionType(Constants.appSection.chat) Global.changeAppSectionBySectionType(Constants.appSection.chat)
root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "")
} }
onReviewContactRequest: { onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null)
Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, 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)
}
onRemoveNickname: (displayName) => { onRemoveNickname: (displayName) => {
root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true) root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true)
} }
onUnblockContact: { onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey)
Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails)
}
onMarkAsUntrusted: {
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true)
Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails)
}
onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey) onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey)
onRemoveContact: { onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey)
Global.removeContactRequested(profileContextMenu.publicKey, contactDetails)
}
onBlockContact: {
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true)
Global.blockContactRequested(profileContextMenu.publicKey, contactDetails)
}
onRemoveFromGroup: { onRemoveFromGroup: {
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey) root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
} }

View File

@ -409,7 +409,7 @@ Item {
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
text: qsTr("Send Contact Request") text: qsTr("Send Contact Request")
onClicked: { onClicked: {
Global.openContactRequestPopup(root.chatId, null, null) Global.openContactRequestPopup(root.chatId, null)
} }
} }
} }

View File

@ -114,7 +114,7 @@ MembersSelectorBase {
if (root.model.count === 0 && !hasPendingContactRequest) { if (root.model.count === 0 && !hasPendingContactRequest) {
// List is empty and not a contact yet. Open the contact request popup // 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)) popup => popup.closed.connect(root.rejected))
return return
} }

View File

@ -342,38 +342,17 @@ Item {
Global.changeAppSectionBySectionType(Constants.appSection.chat) Global.changeAppSectionBySectionType(Constants.appSection.chat)
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.publicKey, "") root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.publicKey, "")
} }
onReviewContactRequest: { onReviewContactRequest: Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, null)
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) onSendContactRequest: Global.openContactRequestPopup(memberContextMenuView.publicKey, null)
Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, contactDetails, null) onEditNickname: Global.openNicknamePopupRequested(memberContextMenuView.publicKey, 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)
}
onRemoveNickname: (displayName) => { onRemoveNickname: (displayName) => {
root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true) root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true)
} }
onUnblockContact: { onUnblockContact: Global.unblockContactRequested(memberContextMenuView.publicKey)
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) onMarkAsUntrusted: Global.markAsUntrustedRequested(memberContextMenuView.publicKey)
Global.unblockContactRequested(memberContextMenuView.publicKey, contactDetails)
}
onMarkAsUntrusted: {
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true)
Global.markAsUntrustedRequested(memberContextMenuView.publicKey, contactDetails)
}
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.publicKey) onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.publicKey)
onRemoveContact: { onRemoveContact: Global.removeContactRequested(memberContextMenuView.publicKey)
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) onBlockContact: Global.blockContactRequested(memberContextMenuView.publicKey)
Global.removeContactRequested(memberContextMenuView.publicKey, contactDetails)
}
onBlockContact: {
const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true)
Global.blockContactRequested(memberContextMenuView.publicKey, contactDetails)
}
onClosed: destroy() onClosed: destroy()
} }
} }

View File

@ -70,38 +70,17 @@ SettingsContentBase {
onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.publicKey, null, null) onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.publicKey, null, null)
onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.publicKey) onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.publicKey)
onReviewContactRequest: () => { onReviewContactRequest: Global.openReviewContactRequestPopup(contactContextMenu.publicKey, null)
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) onSendContactRequest: Global.openContactRequestPopup(contactContextMenu.publicKey, null)
Global.openReviewContactRequestPopup(contactContextMenu.publicKey, contactDetails, null) onEditNickname: Global.openNicknamePopupRequested(contactContextMenu.publicKey, 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)
}
onRemoveNickname: (displayName) => { onRemoveNickname: (displayName) => {
root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true) root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true)
} }
onUnblockContact: () => { onUnblockContact: Global.unblockContactRequested(contactContextMenu.publicKey)
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) onMarkAsUntrusted: Global.markAsUntrustedRequested(contactContextMenu.publicKey)
Global.unblockContactRequested(contactContextMenu.publicKey, contactDetails)
}
onMarkAsUntrusted: () => {
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true)
Global.markAsUntrustedRequested(contactContextMenu.publicKey, contactDetails)
}
onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.publicKey) onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.publicKey)
onRemoveContact: () => { onRemoveContact: Global.removeContactRequested(contactContextMenu.publicKey)
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) onBlockContact: Global.blockContactRequested(contactContextMenu.publicKey)
Global.removeContactRequested(contactContextMenu.publicKey, contactDetails)
}
onBlockContact: () => {
const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true)
Global.blockContactRequested(contactContextMenu.publicKey, contactDetails)
}
onClosed: destroy() onClosed: destroy()
} }
} }

View File

@ -153,20 +153,36 @@ QtObject {
openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup}, cb) openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup}, cb)
} }
function openNicknamePopup(publicKey: string, contactDetails, cb) { function openNicknamePopup(publicKey: string, cb) {
openPopup(nicknamePopupComponent, {publicKey, contactDetails}, cb) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(nicknamePopupComponent, properties, cb)
} }
function openMarkAsUntrustedPopup(publicKey: string, contactDetails) { function openMarkAsUntrustedPopup(publicKey: string) {
openPopup(markAsUntrustedComponent, {publicKey, contactDetails}) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(markAsUntrustedComponent, properties)
} }
function openBlockContactPopup(publicKey: string, contactDetails) { function openBlockContactPopup(publicKey: string) {
openPopup(blockContactConfirmationComponent, {publicKey, contactDetails}) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(blockContactConfirmationComponent, properties)
} }
function openUnblockContactPopup(publicKey: string, contactDetails) { function openUnblockContactPopup(publicKey: string) {
openPopup(unblockContactConfirmationComponent, {publicKey, contactDetails}) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(unblockContactConfirmationComponent, properties)
} }
function openChangeProfilePicPopup(cb) { function openChangeProfilePicPopup(cb) {
@ -182,12 +198,20 @@ QtObject {
openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule}) openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule})
} }
function openMarkAsIDVerifiedPopup(publicKey, contactDetails, cb) { function openMarkAsIDVerifiedPopup(publicKey, cb) {
openPopup(markAsIDVerifiedPopupComponent, {publicKey, contactDetails}, cb) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(markAsIDVerifiedPopupComponent, properties, cb)
} }
function openRemoveIDVerificationDialog(publicKey, contactDetails, cb) { function openRemoveIDVerificationDialog(publicKey, cb) {
openPopup(removeIDVerificationPopupComponent, {publicKey, contactDetails}, cb) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(removeIDVerificationPopupComponent, properties, cb)
} }
function openInviteFriendsToCommunityPopup(community, communitySectionModule, cb) { function openInviteFriendsToCommunityPopup(community, communitySectionModule, cb) {
@ -202,23 +226,27 @@ QtObject {
openPopup(inviteFriendsToCommunityPopup, { community: communityData, communitySectionModule: communitySectionModuleData }, cb) openPopup(inviteFriendsToCommunityPopup, { community: communityData, communitySectionModule: communitySectionModuleData }, cb)
} }
function openContactRequestPopup(publicKey, contactDetails, cb) { function openContactRequestPopup(publicKey, cb) {
let details = contactDetails ?? Utils.getContactDetailsAsJson(publicKey, false) const contactDetails = Utils.getContactDetailsAsJson(
const popupProperties = { publicKey, false, true, true)
publicKey: publicKey, const properties = { publicKey, contactDetails }
contactDetails: details
} openPopup(sendContactRequestPopupComponent, properties, cb)
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
} }
function openReviewContactRequestPopup(publicKey, contactDetails, cb) { function openReviewContactRequestPopup(publicKey, cb) {
try { try {
const crDetails = rootStore.contactStore.getLatestContactRequestForContactAsJson(publicKey) const crDetails = rootStore.contactStore.getLatestContactRequestForContactAsJson(publicKey)
if (crDetails.from !== publicKey) { if (crDetails.from !== publicKey) {
console.warn("Popups.openReviewContactRequestPopup: not matching publicKey:", publicKey) console.warn("Popups.openReviewContactRequestPopup: not matching publicKey:", publicKey)
return 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) { } catch (e) {
console.error("Popups.openReviewContactRequestPopup: error getting or parsing contact request data", e) console.error("Popups.openReviewContactRequestPopup: error getting or parsing contact request data", e)
} }
@ -280,8 +308,12 @@ QtObject {
openPopup(discordImportProgressDialog, {importingSingleChannel: importingSingleChannel}) openPopup(discordImportProgressDialog, {importingSingleChannel: importingSingleChannel})
} }
function openRemoveContactConfirmationPopup(publicKey, contactDetails) { function openRemoveContactConfirmationPopup(publicKey) {
openPopup(removeContactConfirmationDialog, {publicKey, contactDetails}) const contactDetails = Utils.getContactDetailsAsJson(
publicKey, false, true, true)
const properties = { publicKey, contactDetails }
openPopup(removeContactConfirmationDialog, properties)
} }
function openDeleteMessagePopup(messageId, messageStore) { function openDeleteMessagePopup(messageId, messageStore) {

View File

@ -49,6 +49,6 @@ ActivityNotificationMessage {
enabled: root.contactDetails && !root.contactDetails.added && !root.contactDetails.isContactRequestReceived enabled: root.contactDetails && !root.contactDetails.added && !root.contactDetails.isContactRequestReceived
size: StatusBaseButton.Size.Small size: StatusBaseButton.Size.Small
text: qsTr("Send Contact Request") text: qsTr("Send Contact Request")
onClicked: Global.openContactRequestPopup(root.contactId, root.contactDetails, null) onClicked: Global.openContactRequestPopup(root.contactId, null)
} }
} }

View File

@ -129,7 +129,7 @@ Pane {
objectName: "profileDialog_reviewContactRequestButton" objectName: "profileDialog_reviewContactRequestButton"
size: StatusButton.Size.Small size: StatusButton.Size.Small
text: qsTr("Review contact request") 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" objectName: "profileDialog_sendContactRequestButton"
size: StatusButton.Size.Small size: StatusButton.Size.Small
text: qsTr("Send contact request") 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 type: StatusBaseButton.Type.Danger
objectName: "blockUserButton" objectName: "blockUserButton"
text: qsTr("Block user") text: qsTr("Block user")
onClicked: Global.blockContactRequested(root.publicKey, contactDetails) onClicked: Global.blockContactRequested(root.publicKey)
} }
} }
@ -160,7 +160,7 @@ Pane {
size: StatusButton.Size.Small size: StatusButton.Size.Small
objectName: "unblockUserProfileButton" objectName: "unblockUserProfileButton"
text: qsTr("Unblock user") text: qsTr("Unblock user")
onClicked: Global.unblockContactRequested(root.publicKey, contactDetails) onClicked: Global.unblockContactRequested(root.publicKey)
} }
} }
@ -311,38 +311,30 @@ Pane {
SendContactRequestMenuItem { SendContactRequestMenuItem {
enabled: !d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent && enabled: !d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent &&
contactDetails.trustStatus === Constants.trustStatus.untrustworthy // we have an action button otherwise contactDetails.trustStatus === Constants.trustStatus.untrustworthy // we have an action button otherwise
onTriggered: { onTriggered: Global.openContactRequestPopup(root.publicKey, null)
Global.openContactRequestPopup(root.publicKey, contactDetails, null)
}
} }
StatusAction { StatusAction {
text: qsTr("Mark as trusted") text: qsTr("Mark as trusted")
icon.name: "checkmark-circle" icon.name: "checkmark-circle"
enabled: d.isContact && !d.isBlocked && !d.isLocallyTrusted enabled: d.isContact && !d.isBlocked && !d.isLocallyTrusted
onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, contactDetails, null) onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, null)
} }
StatusAction { StatusAction {
objectName: "addEditNickNameStatusAction" objectName: "addEditNickNameStatusAction"
text: d.userNickName ? qsTr("Edit nickname") : qsTr("Add nickname") text: d.userNickName ? qsTr("Edit nickname") : qsTr("Add nickname")
icon.name: "edit_pencil" icon.name: "edit_pencil"
onTriggered: { onTriggered: Global.openNicknamePopupRequested(root.publicKey, null)
Global.openNicknamePopupRequested(root.publicKey, contactDetails, null)
}
} }
StatusAction { StatusAction {
text: qsTr("Show QR code") text: qsTr("Show QR code")
icon.name: "qr" icon.name: "qr"
enabled: !d.isCurrentUser enabled: !d.isCurrentUser
onTriggered: { onTriggered: Global.openPopup(shareProfileCmp)
Global.openPopup(shareProfileCmp)
}
} }
StatusAction { StatusAction {
text: qsTr("Copy link to profile") text: qsTr("Copy link to profile")
icon.name: "copy" icon.name: "copy"
onTriggered: { onTriggered: ClipboardUtils.setText(d.linkToProfile)
ClipboardUtils.setText(d.linkToProfile)
}
} }
StatusMenuSeparator {} StatusMenuSeparator {}
StatusAction { StatusAction {
@ -350,7 +342,7 @@ Pane {
icon.name: "delete" icon.name: "delete"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: d.isContact && d.isLocallyTrusted enabled: d.isContact && d.isLocallyTrusted
onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, contactDetails, null) onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, null)
} }
StatusAction { StatusAction {
text: qsTr("Remove nickname") text: qsTr("Remove nickname")
@ -365,27 +357,21 @@ Pane {
icon.name: "warning" icon.name: "warning"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: contactDetails.trustStatus !== Constants.trustStatus.untrustworthy && !d.isBlocked enabled: contactDetails.trustStatus !== Constants.trustStatus.untrustworthy && !d.isBlocked
onTriggered: { onTriggered: Global.markAsUntrustedRequested(root.publicKey)
Global.markAsUntrustedRequested(root.publicKey, contactDetails)
}
} }
StatusAction { StatusAction {
text: qsTr("Remove untrusted mark") text: qsTr("Remove untrusted mark")
icon.name: "warning" icon.name: "warning"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: contactDetails.trustStatus === Constants.trustStatus.untrustworthy && !d.isBlocked enabled: contactDetails.trustStatus === Constants.trustStatus.untrustworthy && !d.isBlocked
onTriggered: { onTriggered: root.contactsStore.removeTrustStatus(root.publicKey)
root.contactsStore.removeTrustStatus(root.publicKey)
}
} }
StatusAction { StatusAction {
text: qsTr("Remove contact") text: qsTr("Remove contact")
icon.name: "remove-contact" icon.name: "remove-contact"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent enabled: d.isContact && !d.isBlocked && d.contactRequestState !== Constants.ContactRequestState.Sent
onTriggered: { onTriggered: Global.removeContactRequested(root.publicKey)
Global.removeContactRequested(root.publicKey, contactDetails)
}
} }
StatusAction { StatusAction {
text: qsTr("Block user") text: qsTr("Block user")
@ -393,9 +379,7 @@ Pane {
icon.name: "cancel" icon.name: "cancel"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: !d.isBlocked enabled: !d.isBlocked
onTriggered: { onTriggered: Global.blockContactRequested(root.publicKey)
Global.blockContactRequested(root.publicKey, contactDetails)
}
} }
} }
} }

View File

@ -1193,38 +1193,17 @@ Loader {
Global.changeAppSectionBySectionType(Constants.appSection.chat) Global.changeAppSectionBySectionType(Constants.appSection.chat)
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "")
} }
onReviewContactRequest: () => { onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null)
Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, 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)
}
onRemoveNickname: () => { onRemoveNickname: () => {
root.rootStore.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", profileContextMenu.displayName, true) root.rootStore.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", profileContextMenu.displayName, true)
} }
onUnblockContact: () => { onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey)
Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails)
}
onMarkAsUntrusted: () => {
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true)
Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails)
}
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.publicKey) onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.publicKey)
onRemoveContact: () => { onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey)
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey)
Global.removeContactRequested(profileContextMenu.publicKey, contactDetails)
}
onBlockContact: () => {
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true)
Global.blockContactRequested(profileContextMenu.publicKey, contactDetails)
}
onRemoveFromGroup: () => { onRemoveFromGroup: () => {
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey) root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
} }

View File

@ -18,8 +18,8 @@ QtObject {
signal openCreateChatView() signal openCreateChatView()
signal closeCreateChatView() signal closeCreateChatView()
signal blockContactRequested(string publicKey, var contactDetails) signal blockContactRequested(string publicKey)
signal unblockContactRequested(string publicKey, var contactDetails) signal unblockContactRequested(string publicKey)
signal displayToastMessage(string title, string subTitle, string icon, bool loading, int ephNotifType, string url) 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) 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 openPopupRequested(var popupComponent, var params)
signal closePopupRequested() 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 openDownloadModalRequested(bool available, string version, string url)
signal openChangeProfilePicPopup(var cb) signal openChangeProfilePicPopup(var cb)
signal openBackUpSeedPopup() signal openBackUpSeedPopup()
@ -35,12 +35,12 @@ QtObject {
signal openVideoPopup(string url) signal openVideoPopup(string url)
signal openProfilePopupRequested(string publicKey, var parentPopup, var cb) signal openProfilePopupRequested(string publicKey, var parentPopup, var cb)
signal openActivityCenterPopupRequested() signal openActivityCenterPopupRequested()
signal openMarkAsIDVerifiedPopup(string publicKey, var contactDetails, var cb) signal openMarkAsIDVerifiedPopup(string publicKey, var cb)
signal openRemoveIDVerificationDialog(string publicKey, var contactDetails, var cb) signal openRemoveIDVerificationDialog(string publicKey, var cb)
signal openContactRequestPopup(string publicKey, var contactDetails, var cb) signal openContactRequestPopup(string publicKey, var cb)
signal openReviewContactRequestPopup(string publicKey, var contactDetails, var cb) signal openReviewContactRequestPopup(string publicKey, var cb)
signal markAsUntrustedRequested(string publicKey, var contactDetails) signal markAsUntrustedRequested(string publicKey)
signal removeContactRequested(string publicKey, var contactDetails) signal removeContactRequested(string publicKey)
signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb) signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb)
signal openInviteFriendsToCommunityByIdPopup(string communityId, var cb) signal openInviteFriendsToCommunityByIdPopup(string communityId, var cb)
signal openDeleteMessagePopup(string messageId, var messageStore) signal openDeleteMessagePopup(string messageId, var messageStore)