fix(Chat): Fix pin popup and actions for communities and group chats
This commit is contained in:
parent
4d4ec22ba6
commit
8eba843a5e
|
@ -22,11 +22,11 @@ StatusDialog {
|
|||
property string messageToUnpin
|
||||
property string chatId
|
||||
|
||||
property bool isChatBlocked: false
|
||||
property bool isPinActionAvaliable: true
|
||||
|
||||
function updateIsChatBlocked() {
|
||||
const contactDetails = Utils.getContactDetailsAsJson(chatId, false)
|
||||
isChatBlocked = contactDetails && !contactDetails.isContact
|
||||
function updatePinActionAvaliable() {
|
||||
const contactDetails = chatId ? Utils.getContactDetailsAsJson(chatId, false) : null
|
||||
isPinActionAvaliable = contactDetails ? contactDetails.isContact : true
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -34,12 +34,12 @@ StatusDialog {
|
|||
|
||||
function onItemChanged(pubKey) {
|
||||
if (chatId === pubKey) {
|
||||
updateIsChatBlocked()
|
||||
updatePinActionAvaliable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: updateIsChatBlocked()
|
||||
Component.onCompleted: updatePinActionAvaliable()
|
||||
|
||||
width: 800
|
||||
height: 428
|
||||
|
@ -156,7 +156,7 @@ StatusDialog {
|
|||
z: mouseArea.z + 1
|
||||
width: 32
|
||||
height: 32
|
||||
visible: !root.isChatBlocked && !root.messageToPin && (hovered || mouseArea.containsMouse)
|
||||
visible: root.isPinActionAvaliable && !root.messageToPin && (hovered || mouseArea.containsMouse)
|
||||
icon.name: "unpin"
|
||||
tooltip.text: qsTr("Unpin")
|
||||
color: hovered ? Theme.palette.primaryColor2 : Theme.palette.indirectColor1
|
||||
|
|
|
@ -101,7 +101,8 @@ ColumnLayout {
|
|||
console.warn("error on open pinned messages limit reached from message context menu - chat content module is not set")
|
||||
return
|
||||
}
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, chatContentModule.getMyChatId())
|
||||
const chatId = chatType === Constants.chatType.oneToOne ? chatContentModule.getMyChatId() : ""
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, chatId)
|
||||
}
|
||||
|
||||
onToggleReaction: {
|
||||
|
@ -149,10 +150,9 @@ ColumnLayout {
|
|||
stickersPopup: root.stickersPopup
|
||||
usersStore: root.usersStore
|
||||
stickersLoaded: root.stickersLoaded
|
||||
isChatBlocked: root.isBlocked
|
||||
isChatBlocked: root.isBlocked || (chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne && !root.isUserAdded)
|
||||
channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "")
|
||||
isActiveChannel: root.isActiveChannel
|
||||
isUserAdded: root.isUserAdded
|
||||
onShowReplyArea: {
|
||||
let obj = messageStore.getMessageByIdAsJson(messageId)
|
||||
if (!obj) {
|
||||
|
@ -192,7 +192,7 @@ ColumnLayout {
|
|||
isContactBlocked: root.isBlocked
|
||||
isActiveChannel: root.isActiveChannel
|
||||
anchors.bottom: parent.bottom
|
||||
chatType: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown
|
||||
chatType: chatContentModule ? chatContentModule.chatDetails.type : Constants.chatType.unknown
|
||||
suggestions.suggestionFilter.addSystemSuggestions: chatType == Constants.chatType.communityChat
|
||||
|
||||
Binding on chatInputPlaceholder {
|
||||
|
|
|
@ -293,7 +293,7 @@ Item {
|
|||
: ""
|
||||
asset.emoji: emojiIcon
|
||||
asset.emojiSize: "24x24"
|
||||
type: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown
|
||||
type: chatContentModule ? chatContentModule.chatDetails.type : Constants.chatType.unknown
|
||||
pinnedMessagesCount: chatContentModule? chatContentModule.pinnedMessagesModel.count : 0
|
||||
muted: chatContentModule? chatContentModule.chatDetails.muted : false
|
||||
|
||||
|
@ -302,7 +302,8 @@ Item {
|
|||
console.warn("error on open pinned messages - chat content module is not set")
|
||||
return
|
||||
}
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, "", chatContentModule.chatDetails.id)
|
||||
const chatId = type === Constants.chatType.oneToOne ? chatContentModule.getMyChatId() : ""
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, "", chatId)
|
||||
}
|
||||
onUnmute: {
|
||||
if(!chatContentModule) {
|
||||
|
|
|
@ -36,7 +36,6 @@ Item {
|
|||
property alias chatLogView: chatLogView
|
||||
property bool isChatBlocked: false
|
||||
property bool isActiveChannel: false
|
||||
property bool isUserAdded: true
|
||||
|
||||
property var messageContextMenu
|
||||
|
||||
|
@ -226,7 +225,7 @@ Item {
|
|||
chatLogView: ListView.view
|
||||
|
||||
isActiveChannel: root.isActiveChannel
|
||||
isChatBlocked: root.isChatBlocked || !root.isUserAdded
|
||||
isChatBlocked: root.isChatBlocked
|
||||
messageContextMenu: root.messageContextMenu
|
||||
|
||||
messageId: model.id
|
||||
|
|
|
@ -814,7 +814,8 @@ Loader {
|
|||
return;
|
||||
}
|
||||
|
||||
Global.openPinnedMessagesPopupRequested(root.rootStore, messageStore, chatContentModule.pinnedMessagesModel, root.messageId, root.messageStore.getChatId())
|
||||
const chatId = root.messageStore.chatType === Constants.chatType.oneToOne ? chatContentModule.getMyChatId() : ""
|
||||
Global.openPinnedMessagesPopupRequested(root.rootStore, messageStore, chatContentModule.pinnedMessagesModel, root.messageId, chatId)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue