Skip to content

Commit 69bf5f1

Browse files
authored
Merge pull request #48294 from nextcloud/backport/48227/stable30
[stable30] fix(FileList): Show correct avatar for federated share owner
2 parents 5787e5f + 9aaffb8 commit 69bf5f1

8 files changed

Lines changed: 16 additions & 7 deletions

File tree

apps/dav/lib/Connector/Sabre/FilesPlugin.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class FilesPlugin extends ServerPlugin {
5757
public const HAS_PREVIEW_PROPERTYNAME = '{http://nextcloud.org/ns}has-preview';
5858
public const MOUNT_TYPE_PROPERTYNAME = '{http://nextcloud.org/ns}mount-type';
5959
public const MOUNT_ROOT_PROPERTYNAME = '{http://nextcloud.org/ns}is-mount-root';
60+
public const IS_FEDERATED_PROPERTYNAME = '{http://nextcloud.org/ns}is-federated';
6061
public const METADATA_ETAG_PROPERTYNAME = '{http://nextcloud.org/ns}metadata_etag';
6162
public const UPLOAD_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}upload_time';
6263
public const CREATION_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}creation_time';
@@ -118,6 +119,7 @@ public function initialize(Server $server) {
118119
$server->protectedProperties[] = self::DATA_FINGERPRINT_PROPERTYNAME;
119120
$server->protectedProperties[] = self::HAS_PREVIEW_PROPERTYNAME;
120121
$server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME;
122+
$server->protectedProperties[] = self::IS_FEDERATED_PROPERTYNAME;
121123
$server->protectedProperties[] = self::SHARE_NOTE;
122124

123125
// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
@@ -412,6 +414,11 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
412414
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
413415
return $node->getName();
414416
});
417+
418+
$propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function () use ($node) {
419+
return $node->getFileInfo()->getMountPoint()
420+
instanceof \OCA\Files_Sharing\External\Mount;
421+
});
415422
}
416423

417424
if ($node instanceof \OCA\DAV\Connector\Sabre\File) {

apps/files/src/init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@ registerPreviewServiceWorker()
6666

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

7071
initLivePhotos()

apps/files_sharing/src/actions/sharingStatusAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { generateAvatarSvg } from '../utils/AccountIcon'
1818
import './sharingStatusAction.scss'
1919

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

2424
export const action = new FileAction({

apps/files_sharing/src/utils/AccountIcon.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const generateAvatarSvg = (userId: string, isGuest = false) => {
2020

2121
const url = `${basePath}/32${darkModePath}${guestFallback}`
2222
const avatarUrl = generateUrl(url, { userId })
23+
2324
return `<svg width="32" height="32" viewBox="0 0 32 32"
2425
xmlns="http://www.w3.org/2000/svg" class="sharing-status__avatar">
2526
<image href="${avatarUrl}" height="32" width="32" />

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)