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