Add new message action to pin and unpin messages in rooms

Self-explanatory, now you can manage pinned messages in NeoChat alone.
This commit is contained in:
Joshua Goins
2025-02-21 18:11:20 -05:00
parent 9811c0d97a
commit 2861eb9c60
5 changed files with 48 additions and 0 deletions

View File

@@ -132,6 +132,15 @@ KirigamiComponents.ConvergentContextMenu {
}
}
component PinMessageAction: Kirigami.Action {
readonly property bool pinned: currentRoom.isEventPinned(root.eventId)
visible: currentRoom.canSendState("m.room.pinned_events")
text: pinned ? i18nc("@action:button 'Unpin' as in 'Unpin this message'", "Unpin") : i18nc("@action:button 'Pin' as in 'Pin the message in the room'", "Pin")
icon.name: pinned ? "window-unpin-symbolic" : "pin-symbolic"
onTriggered: pinned ? currentRoom.unpinEvent(root.eventId) : currentRoom.pinEvent(root.eventId)
}
headerContentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing