Skip to content

Commit

Permalink
Merge pull request #48294 from nextcloud/backport/48227/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(FileList): Show correct avatar for federated share owner
  • Loading branch information
nfebe authored Oct 30, 2024
2 parents 5787e5f + 9aaffb8 commit 69bf5f1
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class FilesPlugin extends ServerPlugin {
public const HAS_PREVIEW_PROPERTYNAME = '{http://nextcloud.org/ns}has-preview';
public const MOUNT_TYPE_PROPERTYNAME = '{http://nextcloud.org/ns}mount-type';
public const MOUNT_ROOT_PROPERTYNAME = '{http://nextcloud.org/ns}is-mount-root';
public const IS_FEDERATED_PROPERTYNAME = '{http://nextcloud.org/ns}is-federated';
public const METADATA_ETAG_PROPERTYNAME = '{http://nextcloud.org/ns}metadata_etag';
public const UPLOAD_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}upload_time';
public const CREATION_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}creation_time';
Expand Down Expand Up @@ -118,6 +119,7 @@ public function initialize(Server $server) {
$server->protectedProperties[] = self::DATA_FINGERPRINT_PROPERTYNAME;
$server->protectedProperties[] = self::HAS_PREVIEW_PROPERTYNAME;
$server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME;
$server->protectedProperties[] = self::IS_FEDERATED_PROPERTYNAME;
$server->protectedProperties[] = self::SHARE_NOTE;

// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
Expand Down Expand Up @@ -412,6 +414,11 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
return $node->getName();
});

$propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function () use ($node) {
return $node->getFileInfo()->getMountPoint()
instanceof \OCA\Files_Sharing\External\Mount;
});
}

if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
Expand Down
1 change: 1 addition & 0 deletions apps/files/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ registerPreviewServiceWorker()

registerDavProperty('nc:hidden', { nc: 'http://nextcloud.org/ns' })
registerDavProperty('nc:is-mount-root', { nc: 'http://nextcloud.org/ns' })
registerDavProperty('nc:is-federated', { nc: 'http://nextcloud.org/ns' })

initLivePhotos()
2 changes: 1 addition & 1 deletion apps/files_sharing/src/actions/sharingStatusAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { generateAvatarSvg } from '../utils/AccountIcon'
import './sharingStatusAction.scss'

const isExternal = (node: Node) => {
return node.attributes.remote_id !== undefined
return node.attributes?.['is-federated'] ?? false
}

export const action = new FileAction({
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/src/utils/AccountIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const generateAvatarSvg = (userId: string, isGuest = false) => {

const url = `${basePath}/32${darkModePath}${guestFallback}`
const avatarUrl = generateUrl(url, { userId })

return `<svg width="32" height="32" viewBox="0 0 32 32"
xmlns="http://www.w3.org/2000/svg" class="sharing-status__avatar">
<image href="${avatarUrl}" height="32" width="32" />
Expand Down
4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-init.js.map

Large diffs are not rendered by default.

0 comments on commit 69bf5f1

Please sign in to comment.