diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-02-20 12:24:49 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-02-20 17:28:08 +0100 |
commit | d565ef4923c669a8a9cdaf0e4c554ad95c94042d (patch) | |
tree | 149d0a5ee39955b22c9e681d2a2ba6f5d56096b7 | |
parent | 4f50b5f337fb5721ff484af877ee1f2d5bf4af4a (diff) | |
download | nextcloud-server-d565ef4923c669a8a9cdaf0e4c554ad95c94042d.tar.gz nextcloud-server-d565ef4923c669a8a9cdaf0e4c554ad95c94042d.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 2224a1d3967..936c1afafc4 100644 --- a/apps/files_sharing/src/services/SharingService.spec.ts +++ b/apps/files_sharing/src/services/SharingService.spec.ts @@ -355,6 +355,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 01a92cfff87..d8c6747f89c 100644 --- a/apps/files_sharing/src/services/SharingService.ts +++ b/apps/files_sharing/src/services/SharingService.ts @@ -71,6 +71,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, @@ -88,7 +99,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) { |