Skip to content

Commit

Permalink
Merge pull request #11859 from owncloud/fix-show-lock-info
Browse files Browse the repository at this point in the history
fix: lock owner in file details
  • Loading branch information
kulmann authored Nov 6, 2024
2 parents 005db49 + dbab230 commit 346296b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 107 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-lock-information
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Show lock information in file details

We fixed showing the lock owner in the file details whenever a file is locked.

https://github.com/owncloud/web/issues/11008
https://github.com/owncloud/web/pull/11859
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@
</td>
</tr>
<tr v-if="resource.locked" data-testid="locked-by">
<th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Locked by')" />
<th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Locked via')" />
<td>
<span>{{ resource.lockOwnerName }} ({{ formatDateRelative(resource.lockTime) }})</span>
<span>{{ resource.lockOwner }}</span>
<span v-if="resource.lockTime">({{ formatDateRelative(resource.lockTime) }})</span>
</td>
</tr>
<tr v-if="showSharedVia" data-testid="shared-via">
Expand Down
8 changes: 4 additions & 4 deletions packages/web-client/src/helpers/resource/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export function buildResource(resource: WebDavResponseResource): Resource {
const extension = extractExtensionFromFile({ ...resource, id, name, path: resourcePath })

const lock = resource.props[DavProperty.LockDiscovery]
let activeLock: { [DavProperty.LockOwnerName]?: string; [DavProperty.LockTime]?: string }
let lockOwnerName: string, lockTime: string
let activeLock: { [DavProperty.LockOwner]?: string; [DavProperty.LockTime]?: string }
let lockOwner: string, lockTime: string
if (lock) {
activeLock = lock[DavProperty.ActiveLock]
lockOwnerName = activeLock[DavProperty.LockOwnerName]
lockOwner = activeLock[DavProperty.LockOwner]
lockTime = activeLock[DavProperty.LockTime]
}

Expand All @@ -131,7 +131,7 @@ export function buildResource(resource: WebDavResponseResource): Resource {
type: isFolder ? 'folder' : resource.type,
isFolder,
locked: !!activeLock,
lockOwnerName,
lockOwner,
lockTime,
processing: resource.processing || false,
mdate: resource.props[DavProperty.LastModifiedDate],
Expand Down
2 changes: 1 addition & 1 deletion packages/web-client/src/helpers/resource/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface Resource {
thumbnail?: string
processing?: boolean
locked?: boolean
lockOwnerName?: string
lockOwner?: string
lockTime?: string
mimeType?: string
isFolder?: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/web-client/src/webdav/constants/dav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const DavPropertyMapping = {
MimeType: defString('getcontenttype' as const),
ResourceType: defStringArray('resourcetype' as const),
LockDiscovery: { value: 'lockdiscovery', type: null as Record<string, unknown> },
LockOwnerName: defString('ownername' as const),
LockOwner: defString('owner' as const),
LockTime: defString('locktime' as const),
ActiveLock: {
value: 'activelock',
Expand Down
2 changes: 1 addition & 1 deletion packages/web-test-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"postpublish": "rm -rf ./package"
},
"peerDependencies": {
"@ownclouders/web-pkg": "^11.0.0",
"@ownclouders/web-pkg": "workspace:^",
"@vue/test-utils": "^2.4.6",
"vue": "^3.5.10"
},
Expand Down
103 changes: 5 additions & 98 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 346296b

Please sign in to comment.