diff --git a/src/app/modules/main/profile_section/contacts/view.nim b/src/app/modules/main/profile_section/contacts/view.nim index 5aa7641fc6..7073b24847 100644 --- a/src/app/modules/main/profile_section/contacts/view.nim +++ b/src/app/modules/main/profile_section/contacts/view.nim @@ -115,6 +115,9 @@ QtObject: read = getSentButRejectedContactRequestsModel notify = sentButRejectedContactRequestsModelChanged + proc isMyMutualContact*(self: View, publicKey: string): bool {.slot.} = + return self.myMutualContactsModel.containsItemWithPubKey(publicKey) + proc addContact*(self: View, publicKey: string) {.slot.} = self.delegate.addContact(publicKey) diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 4b2d0e661d..a43fb487ce 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -16,7 +16,7 @@ QtObject { property string createChatStickerHashId: "" property string createChatStickerPackId: "" - property var contactsModel: profileSectionModule.contactsModule.myContactsModel + property var contactsModel: root.contactsStore.myContactsModel // Important: // Each `ChatLayout` has its own chatCommunitySectionModule diff --git a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml index 91653af262..5bbdb42b6b 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml @@ -43,9 +43,9 @@ StatusListItem { signal openProfilePopup(string publicKey) signal openChangeNicknamePopup(string publicKey) signal sendMessageActionTriggered(string publicKey) - signal acceptContactRequest(string publicKey) - signal rejectContactRequest(string publicKey) - signal removeRejection(string publicKey) + signal contactRequestAccepted(string publicKey) + signal contactRequestRejected(string publicKey) + signal rejectionRemoved(string publicKey) signal textClicked(string publicKey) components: [ @@ -63,7 +63,7 @@ StatusListItem { height: visible ? 32 : 0 icon.name: "close-circle" icon.color: Style.current.danger - onClicked: container.rejectContactRequest(container.publicKey) + onClicked: container.contactRequestRejected(container.publicKey) }, StatusFlatRoundButton { visible: showAcceptContactRequestButton @@ -71,7 +71,7 @@ StatusListItem { height: visible ? 32 : 0 icon.name: "checkmark-circle" icon.color: Style.current.success - onClicked: container.acceptContactRequest(container.publicKey) + onClicked: container.contactRequestAccepted(container.publicKey) }, StatusFlatRoundButton { visible: showRemoveRejectionButton @@ -79,7 +79,7 @@ StatusListItem { height: visible ? 32 : 0 icon.name: "cancel" icon.color: Style.current.danger - onClicked: container.removeRejection(container.publicKey) + onClicked: container.rejectionRemoved(container.publicKey) }, StatusBaseText { text: container.contactText diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index 1262ecc891..bfe0aff040 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -25,9 +25,9 @@ Item { signal openProfilePopup(string publicKey) signal sendMessageActionTriggered(string publicKey) signal openChangeNicknamePopup(string publicKey) - signal acceptContactRequest(string publicKey) - signal rejectContactRequest(string publicKey) - signal removeRejection(string publicKey) + signal contactRequestAccepted(string publicKey) + signal contactRequestRejected(string publicKey) + signal rejectionRemoved(string publicKey) signal textClicked(string publicKey) visible: contactsList.count > 0 @@ -150,9 +150,9 @@ Item { onOpenProfilePopup: contactListRoot.openProfilePopup(publicKey) onSendMessageActionTriggered: contactListRoot.sendMessageActionTriggered(publicKey) onOpenChangeNicknamePopup: contactListRoot.openChangeNicknamePopup(publicKey) - onAcceptContactRequest: contactListRoot.acceptContactRequest(publicKey) - onRejectContactRequest: contactListRoot.rejectContactRequest(publicKey) - onRemoveRejection: contactListRoot.removeRejection(publicKey) + onContactRequestAccepted: contactListRoot.contactRequestAccepted(publicKey) + onContactRequestRejected: contactListRoot.contactRequestRejected(publicKey) + onRejectionRemoved: contactListRoot.rejectionRemoved(publicKey) onTextClicked: contactListRoot.textClicked(publicKey) visible: searchString === "" || diff --git a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml index 308a833189..80c174d6a8 100644 --- a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml @@ -30,6 +30,10 @@ QtObject { return root.globalUtilsInst.getFromClipboard() } + function isMyMutualContact(pubKey) { + return root.contactsModule.isMyMutualContact(pubKey) + } + function joinPrivateChat(pubKey) { Global.changeAppSectionBySectionType(Constants.appSection.chat) root.contactsModule.addContact(pubKey) diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index f201f9373b..93b0ab72ca 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -221,11 +221,11 @@ Item { Global.openProfilePopup(publicKey, null, true) } - onAcceptContactRequest: { + onContactRequestAccepted: { root.contactsStore.acceptContactRequest(publicKey) } - onRejectContactRequest: { + onContactRequestRejected: { root.contactsStore.rejectContactRequest(publicKey) } } @@ -280,7 +280,7 @@ Item { Global.openProfilePopup(publicKey, null, true) } - onRemoveRejection: { + onRejectionRemoved: { root.contactsStore.removeContactRequestRejection(publicKey) } } diff --git a/ui/imports/shared/views/chat/MessageContextMenuView.qml b/ui/imports/shared/views/chat/MessageContextMenuView.qml index 39c74d46de..645ee3aea1 100644 --- a/ui/imports/shared/views/chat/MessageContextMenuView.qml +++ b/ui/imports/shared/views/chat/MessageContextMenuView.qml @@ -188,8 +188,7 @@ StatusPopupMenu { root.close() } icon.name: "chat" - enabled: (root.myPublicKey !== root.selectedUserPublicKey) && - root.isProfile && !root.isMyMessage || + enabled: root.isProfile && root.store.contactsStore.isMyMutualContact(root.selectedUserPublicKey) || (!root.hideEmojiPicker && !root.emojiOnly && !root.isProfile &&