feat(Chat): Disable unpin action for PinnedMessagesPopup
This commit is contained in:
parent
1f54d96f5f
commit
4d4ec22ba6
|
@ -20,6 +20,26 @@ StatusDialog {
|
||||||
property var pinnedMessagesModel //this doesn't belong to the messageStore, it is a part of the ChatContentStore, but we didn't introduce it yet.
|
property var pinnedMessagesModel //this doesn't belong to the messageStore, it is a part of the ChatContentStore, but we didn't introduce it yet.
|
||||||
property string messageToPin
|
property string messageToPin
|
||||||
property string messageToUnpin
|
property string messageToUnpin
|
||||||
|
property string chatId
|
||||||
|
|
||||||
|
property bool isChatBlocked: false
|
||||||
|
|
||||||
|
function updateIsChatBlocked() {
|
||||||
|
const contactDetails = Utils.getContactDetailsAsJson(chatId, false)
|
||||||
|
isChatBlocked = contactDetails && !contactDetails.isContact
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.store.contactsStore.myContactsModel
|
||||||
|
|
||||||
|
function onItemChanged(pubKey) {
|
||||||
|
if (chatId === pubKey) {
|
||||||
|
updateIsChatBlocked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: updateIsChatBlocked()
|
||||||
|
|
||||||
width: 800
|
width: 800
|
||||||
height: 428
|
height: 428
|
||||||
|
@ -101,9 +121,9 @@ StatusDialog {
|
||||||
// This is possible since we have all data loaded before we load qml.
|
// This is possible since we have all data loaded before we load qml.
|
||||||
// When we fetch messages to fulfill a gap we have to set them at once.
|
// When we fetch messages to fulfill a gap we have to set them at once.
|
||||||
prevMessageIndex: index - 1
|
prevMessageIndex: index - 1
|
||||||
prevMessageAsJsonObj: root.messageStore? root.messageStore.getMessageByIndexAsJson(index - 1) : {}
|
prevMessageAsJsonObj: root.messageStore ? root.messageStore.getMessageByIndexAsJson(index - 1) : {}
|
||||||
nextMessageIndex: index + 1
|
nextMessageIndex: index + 1
|
||||||
nextMessageAsJsonObj: root.messageStore? root.messageStore.getMessageByIndexAsJson(index + 1) : {}
|
nextMessageAsJsonObj: root.messageStore ? root.messageStore.getMessageByIndexAsJson(index + 1) : {}
|
||||||
|
|
||||||
// Additional params
|
// Additional params
|
||||||
isInPinnedPopup: true
|
isInPinnedPopup: true
|
||||||
|
@ -136,7 +156,7 @@ StatusDialog {
|
||||||
z: mouseArea.z + 1
|
z: mouseArea.z + 1
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
visible: !root.messageToPin && (hovered || mouseArea.containsMouse)
|
visible: !root.isChatBlocked && !root.messageToPin && (hovered || mouseArea.containsMouse)
|
||||||
icon.name: "unpin"
|
icon.name: "unpin"
|
||||||
tooltip.text: qsTr("Unpin")
|
tooltip.text: qsTr("Unpin")
|
||||||
color: hovered ? Theme.palette.primaryColor2 : Theme.palette.indirectColor1
|
color: hovered ? Theme.palette.primaryColor2 : Theme.palette.indirectColor1
|
||||||
|
|
|
@ -101,7 +101,7 @@ ColumnLayout {
|
||||||
console.warn("error on open pinned messages limit reached from message context menu - chat content module is not set")
|
console.warn("error on open pinned messages limit reached from message context menu - chat content module is not set")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId)
|
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, chatContentModule.getMyChatId())
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggleReaction: {
|
onToggleReaction: {
|
||||||
|
|
|
@ -302,7 +302,7 @@ Item {
|
||||||
console.warn("error on open pinned messages - chat content module is not set")
|
console.warn("error on open pinned messages - chat content module is not set")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, "")
|
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, "", chatContentModule.chatDetails.id)
|
||||||
}
|
}
|
||||||
onUnmute: {
|
onUnmute: {
|
||||||
if(!chatContentModule) {
|
if(!chatContentModule) {
|
||||||
|
|
|
@ -168,9 +168,14 @@ QtObject {
|
||||||
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
openPopup(sendContactRequestPopupComponent, popupProperties, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPinnedMessagesPopup(store, messageStore, pinnedMessagesModel, messageToPin) {
|
function openPinnedMessagesPopup(store, messageStore, pinnedMessagesModel, messageToPin, chatId) {
|
||||||
openPopup(pinnedMessagesPopup, { store: store, messageStore: messageStore,
|
openPopup(pinnedMessagesPopup, {
|
||||||
pinnedMessagesModel: pinnedMessagesModel, messageToPin: messageToPin})
|
store: store,
|
||||||
|
messageStore: messageStore,
|
||||||
|
pinnedMessagesModel: pinnedMessagesModel,
|
||||||
|
messageToPin: messageToPin,
|
||||||
|
chatId: chatId
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function openCommunityPopup(store, community, chatCommunitySectionModule) {
|
function openCommunityPopup(store, community, chatCommunitySectionModule) {
|
||||||
|
|
|
@ -814,7 +814,7 @@ Loader {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.openPinnedMessagesPopupRequested(root.rootStore, messageStore, chatContentModule.pinnedMessagesModel, root.messageId)
|
Global.openPinnedMessagesPopupRequested(root.rootStore, messageStore, chatContentModule.pinnedMessagesModel, root.messageId, root.messageStore.getChatId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@ QtObject {
|
||||||
property var userProfile
|
property var userProfile
|
||||||
property bool appIsReady: false
|
property bool appIsReady: false
|
||||||
|
|
||||||
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin)
|
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin, string chatId)
|
||||||
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)
|
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)
|
||||||
|
|
||||||
signal openLinkInBrowser(string link)
|
signal openLinkInBrowser(string link)
|
||||||
|
|
Loading…
Reference in New Issue