Skip to content

Commit

Permalink
fix: Use icons instead of avatar for locking indication
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr committed Dec 19, 2024
1 parent 0aa85e3 commit 4d61e34
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { lockFile, unlockFile } from './api'
import { LockType } from './types'
import {
canLock, canUnlock,
generateAvatarSvg,
getInfoLabel,
getLockStateFromAttributes,
} from './helper'
Expand All @@ -29,6 +28,8 @@ import '@nextcloud/dialogs/style.css'
import LockSvg from '@mdi/svg/svg/lock.svg?raw'
import LockOpenSvg from '@mdi/svg/svg/lock-open-variant.svg?raw'
import LockEditSvg from '@mdi/svg/svg/pencil-lock.svg?raw'
import LockMonitorSvg from '@mdi/svg/svg/monitor-lock.svg?raw'
import LockAccountSvg from '@mdi/svg/svg/account-lock.svg?raw'

const switchLock = async (node: Node) => {
try {
Expand Down Expand Up @@ -73,14 +74,18 @@ const inlineAction = new FileAction({
return ''
}

if (state.isLocked && state.lockOwnerType !== LockType.App && state.lockOwner !== getCurrentUser()?.uid) {
return generateAvatarSvg(state.lockOwner)
if (state.lockOwnerType === LockType.Token) {
return LockMonitorSvg
}

if (state.lockOwnerType === LockType.App) {
return LockEditSvg
}

if (state.lockOwner !== getCurrentUser()?.uid) {
return LockAccountSvg
}

return LockSvg
},

Expand Down

0 comments on commit 4d61e34

Please sign in to comment.