fix(@desktop/pinned): proper popup menu for pinned messages dialog
This commit is contained in:
parent
c5d841f68d
commit
87b3f4f2c0
|
@ -22,6 +22,7 @@ Item {
|
|||
case Constants.chatTypePublic: return isCurrentUser
|
||||
case Constants.chatTypeCommunity: return chatsModel.communities.activeCommunity.admin ? true : isCurrentUser
|
||||
case Constants.chatTypeStatusUpdate: return false
|
||||
default: return false
|
||||
}
|
||||
property bool showEdit: true
|
||||
property var messageContextMenu
|
||||
|
|
|
@ -13,7 +13,6 @@ import "./"
|
|||
StatusPopupMenu {
|
||||
id: messageContextMenu
|
||||
width: emojiContainer.visible ? emojiContainer.width : 176
|
||||
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
||||
|
||||
property string messageId
|
||||
property int contentType
|
||||
|
@ -22,7 +21,7 @@ StatusPopupMenu {
|
|||
property bool emojiOnly: false
|
||||
property bool hideEmojiPicker: false
|
||||
property bool pinnedMessage: false
|
||||
property bool showJumpTo: false
|
||||
property bool pinnedPopup: false
|
||||
property bool isText: false
|
||||
property bool isCurrentUser: false
|
||||
property string linkUrls: ""
|
||||
|
@ -37,11 +36,10 @@ StatusPopupMenu {
|
|||
property var reactionModel
|
||||
property bool canPin: {
|
||||
const nbPinnedMessages = chatsModel.messageView.pinnedMessagesList.count
|
||||
|
||||
return nbPinnedMessages < Constants.maxNumberOfPins
|
||||
}
|
||||
|
||||
signal closeParentPopup
|
||||
signal shouldCloseParentPopup
|
||||
|
||||
function show(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, emojiReactionsModel) {
|
||||
userName = userNameParam || ""
|
||||
|
@ -282,7 +280,7 @@ StatusPopupMenu {
|
|||
|
||||
StatusMenuItem {
|
||||
id: deleteMessageAction
|
||||
enabled: isCurrentUser && !isProfile && !emojiOnly &&
|
||||
enabled: isCurrentUser && !isProfile && !emojiOnly && !pinnedPopup &&
|
||||
(contentType === Constants.messageType ||
|
||||
contentType === Constants.stickerType ||
|
||||
contentType === Constants.emojiType ||
|
||||
|
@ -315,4 +313,15 @@ StatusPopupMenu {
|
|||
icon.name: "delete"
|
||||
type: StatusMenuItem.Type.Danger
|
||||
}
|
||||
|
||||
StatusMenuItem {
|
||||
enabled: messageContextMenu.pinnedPopup
|
||||
text: qsTr("Jump to")
|
||||
onTriggered: {
|
||||
positionAtMessage(messageContextMenu.messageId)
|
||||
messageContextMenu.close()
|
||||
messageContextMenu.shouldCloseParentPopup()
|
||||
}
|
||||
icon.name: "up"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,14 +101,14 @@ ModalPopup {
|
|||
function closePopup() {
|
||||
popup.close()
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
property var listView: ListView.view
|
||||
width: parent.width
|
||||
height: messageItem.height
|
||||
|
||||
Message {
|
||||
id: messageItem
|
||||
property var view: ListView.view
|
||||
|
||||
fromAuthor: model.fromAuthor
|
||||
chatId: model.chatId
|
||||
userName: model.userName
|
||||
|
@ -138,14 +138,11 @@ ModalPopup {
|
|||
isEdited: model.isEdited
|
||||
showEdit: false
|
||||
messageContextMenu: MessageContextMenu {
|
||||
showJumpTo: true
|
||||
pinnedPopup: true
|
||||
pinnedMessage: true
|
||||
reactionModel: EmojiReactions { }
|
||||
|
||||
onCloseParentPopup: {
|
||||
if (messageItem.view) {
|
||||
messageItem.view.closePopup()
|
||||
}
|
||||
reactionModel: EmojiReactions {}
|
||||
onShouldCloseParentPopup: {
|
||||
listView.closePopup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue