diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-02-20 12:24:49 +0100 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2025-03-06 16:32:44 +0100 |
commit | de0edc5963b0299a3e5532ad0f56624acb0b51df (patch) | |
tree | 61899d299aff79b4f0ed37e5993a9f0770867463 | |
parent | 48a643f8c1d7573a4cc533dd91c4e4185efe87a7 (diff) | |
download | nextcloud-server-de0edc5963b0299a3e5532ad0f56624acb0b51df.tar.gz nextcloud-server-de0edc5963b0299a3e5532ad0f56624acb0b51df.zip |
fix(files_sharing): Map sharee information for `shared-by-you` view
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/files_sharing/src/services/SharingService.spec.ts | 7 | ||||
-rw-r--r-- | apps/files_sharing/src/services/SharingService.ts | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/apps/files_sharing/src/services/SharingService.spec.ts b/apps/files_sharing/src/services/SharingService.spec.ts index dc220475b19..64f76855283 100644 --- a/apps/files_sharing/src/services/SharingService.spec.ts +++ b/apps/files_sharing/src/services/SharingService.spec.ts @@ -358,6 +358,13 @@ describe('SharingService share to Node mapping', () => { expect(file.root).toBe('/files/test') expect(file.attributes).toBeInstanceOf(Object) expect(file.attributes['has-preview']).toBe(true) + expect(file.attributes.sharees).toEqual({ + sharee: { + id: 'user00', + 'display-name': 'User00', + type: 0, + }, + }) expect(file.attributes.favorite).toBe(0) }) diff --git a/apps/files_sharing/src/services/SharingService.ts b/apps/files_sharing/src/services/SharingService.ts index 6939ecfcfb1..91fe64edcc4 100644 --- a/apps/files_sharing/src/services/SharingService.ts +++ b/apps/files_sharing/src/services/SharingService.ts @@ -81,6 +81,17 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise<Folder | File | nu mtime = new Date((ocsEntry.stime) * 1000) } + let sharees: { sharee: object } | undefined + if ('share_with' in ocsEntry) { + sharees = { + sharee: { + id: ocsEntry.share_with, + 'display-name': ocsEntry.share_with_displayname || ocsEntry.share_with, + type: ocsEntry.share_type, + }, + } + } + return new Node({ id: fileid, source, @@ -98,7 +109,8 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise<Folder | File | nu 'owner-display-name': ocsEntry?.displayname_owner, 'share-types': ocsEntry?.share_type, 'share-attributes': ocsEntry?.attributes || '[]', - favorite: ocsEntry?.tags?.includes((window.OC as Nextcloud.v29.OC & { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0, + sharees, + favorite: ocsEntry?.tags?.includes((window.OC as { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0, }, }) } catch (error) { |