From 83ec0b03145ca69bc782040254adab6dce1b33f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 9 May 2024 17:14:40 +0200 Subject: [PATCH] fix: Show lock status for read only files and allow unlocking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index d4b1d288..d8e9a27e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -85,7 +85,7 @@ const inlineAction = new FileAction({ const node = nodes[0] const state = getLockStateFromAttributes(node) - return (node.permissions & Permission.UPDATE) !== 0 && state.isLocked + return state.isLocked }, }) @@ -115,8 +115,10 @@ const menuAction = new FileAction({ } const canToggleLock = canLock(nodes[0]) || canUnlock(nodes[0]) + const isLocked = getLockStateFromAttributes(nodes[0]).isLocked + const isUpdatable = (nodes[0].permissions & Permission.UPDATE) !== 0 - return nodes[0].type === FileType.File && canToggleLock && (nodes[0].permissions & Permission.UPDATE) !== 0 + return nodes[0].type === FileType.File && canToggleLock && (isUpdatable || isLocked) }, async exec(node: Node) {