fix(MessageView): missing popup from when pin limit is reached

Can not use `root.messageStore.getNumberOfPinnedMessages()` directly in a
binding, as it's not a property and won't reevaluate on change

Closes #7314
This commit is contained in:
Lukáš Tinkl 2022-09-12 18:42:58 +02:00 committed by Lukáš Tinkl
parent 5e0d5a9f8c
commit d0b8af9e86
1 changed files with 3 additions and 5 deletions

View File

@ -150,7 +150,7 @@ Loader {
messageContextMenu.messageSenderId = root.senderId messageContextMenu.messageSenderId = root.senderId
messageContextMenu.messageContentType = root.messageContentType messageContextMenu.messageContentType = root.messageContentType
messageContextMenu.pinnedMessage = root.pinnedMessage messageContextMenu.pinnedMessage = root.pinnedMessage
messageContextMenu.canPin = d.canPin messageContextMenu.canPin = !!root.messageStore && root.messageStore.getNumberOfPinnedMessages() < Constants.maxNumberOfPins
messageContextMenu.selectedUserPublicKey = root.senderId messageContextMenu.selectedUserPublicKey = root.senderId
messageContextMenu.selectedUserDisplayName = root.senderDisplayName messageContextMenu.selectedUserDisplayName = root.senderDisplayName
@ -232,8 +232,6 @@ Loader {
QtObject { QtObject {
id: d id: d
readonly property bool canPin: !!messageStore &&
messageStore.getNumberOfPinnedMessages() < Constants.maxNumberOfPins
readonly property int chatButtonSize: 32 readonly property int chatButtonSize: 32
property string activeMessage property string activeMessage
@ -732,7 +730,7 @@ Loader {
return; return;
} }
if (d.canPin) { if (!!root.messageStore && root.messageStore.getNumberOfPinnedMessages() < Constants.maxNumberOfPins) {
messageStore.pinMessage(root.messageId) messageStore.pinMessage(root.messageId)
return; return;
} }
@ -742,7 +740,7 @@ Loader {
return; return;
} }
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(Global.pinnedMessagesPopup, {
store: root.rootStore, store: root.rootStore,
messageStore: messageStore, messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel, pinnedMessagesModel: chatContentModule.pinnedMessagesModel,