fix(@desktop/chat): contact lists should only shown mutual contacts
Fixes #5117
This commit is contained in:
parent
149ff69310
commit
57fb0882aa
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 === "" ||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 &&
|
||||
|
|
Loading…
Reference in New Issue