diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2024-09-27 11:52:53 +0200 |
---|---|---|
committer | Julien Veyssier <julien-nc@posteo.net> | 2024-09-30 10:22:48 +0200 |
commit | 0af363714d0999cb157902ce952a5b4c6e5f2277 (patch) | |
tree | cdedf6a9f8e4061cbb29a82f0e2d5cdbcbcecc6a | |
parent | 526a504e82e35c9febe6a62bece47171a8998470 (diff) | |
download | nextcloud-server-0af363714d0999cb157902ce952a5b4c6e5f2277.tar.gz nextcloud-server-0af363714d0999cb157902ce952a5b4c6e5f2277.zip |
fix(filesharing): file appear as shared by their owner if it has a numerical user ID
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
-rw-r--r-- | apps/files_sharing/src/actions/sharingStatusAction.ts | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/files_sharing/src/actions/sharingStatusAction.ts b/apps/files_sharing/src/actions/sharingStatusAction.ts index 8dd1b403304..75b63c58854 100644 --- a/apps/files_sharing/src/actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/actions/sharingStatusAction.ts @@ -35,7 +35,7 @@ import { generateAvatarSvg } from '../utils/AccountIcon.ts' import './sharingStatusAction.scss' const isExternal = (node: Node) => { - return node.attributes?.['is-federated'] ?? false + return node.attributes.remote_id !== undefined } export const action = new FileAction({ @@ -43,10 +43,9 @@ export const action = new FileAction({ displayName(nodes: Node[]) { const node = nodes[0] const shareTypes = Object.values(node?.attributes?.['share-types'] || {}).flat() as number[] - const ownerId = node?.attributes?.['owner-id'] if (shareTypes.length > 0 - || (ownerId !== getCurrentUser()?.uid || isExternal(node))) { + || (node.owner !== getCurrentUser()?.uid || isExternal(node))) { return t('files_sharing', 'Shared') } @@ -55,15 +54,14 @@ export const action = new FileAction({ title(nodes: Node[]) { const node = nodes[0] - const ownerId = node?.attributes?.['owner-id'] - const ownerDisplayName = node?.attributes?.['owner-display-name'] // Mixed share types if (Array.isArray(node.attributes?.['share-types']) && node.attributes?.['share-types'].length > 1) { return t('files_sharing', 'Shared multiple times with different people') } - if (ownerId && (ownerId !== getCurrentUser()?.uid || isExternal(node))) { + if (node.owner && (node.owner !== getCurrentUser()?.uid || isExternal(node))) { + const ownerDisplayName = node?.attributes?.['owner-display-name'] return t('files_sharing', 'Shared by {ownerDisplayName}', { ownerDisplayName }) } @@ -96,10 +94,9 @@ export const action = new FileAction({ return CircleSvg } - const ownerId = node?.attributes?.['owner-id'] - if (ownerId && (ownerId !== getCurrentUser()?.uid || isExternal(node))) { + if (node.owner && (node.owner !== getCurrentUser()?.uid || isExternal(node))) { const sanitizeId = (id: string) => id.replace(/[^a-zA-Z0-9._%+@-]+/g, '').replace(/\//g, '') - return generateAvatarSvg(sanitizeId(ownerId), isExternal(node)) + return generateAvatarSvg(sanitizeId(node.owner), isExternal(node)) } return AccountPlusSvg @@ -111,8 +108,8 @@ export const action = new FileAction({ } const node = nodes[0] - const ownerId = node?.attributes?.['owner-id'] - const isMixed = Array.isArray(node.attributes?.['share-types']) + const shareTypes = node.attributes?.['share-types'] + const isMixed = Array.isArray(shareTypes) && shareTypes.length > 0 // If the node is shared multiple times with // different share types to the current user @@ -121,7 +118,7 @@ export const action = new FileAction({ } // If the node is shared by someone else - if (ownerId && (ownerId !== getCurrentUser()?.uid || isExternal(node))) { + if (node.owner && (node.owner !== getCurrentUser()?.uid || isExternal(node))) { return true } |