Skip to content

Commit 1364744

Browse files
authored
Merge pull request #50918 from nextcloud/fix/map-sharee-information
fix(files_sharing): Map sharee information for `shared-by-you` view
2 parents f35af25 + 03fdcb7 commit 1364744

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

apps/files_sharing/src/services/SharingService.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@ describe('SharingService share to Node mapping', () => {
355355
expect(file.root).toBe('/files/test')
356356
expect(file.attributes).toBeInstanceOf(Object)
357357
expect(file.attributes['has-preview']).toBe(true)
358+
expect(file.attributes.sharees).toEqual({
359+
sharee: {
360+
id: 'user00',
361+
'display-name': 'User00',
362+
type: 0,
363+
},
364+
})
358365
expect(file.attributes.favorite).toBe(0)
359366
})
360367

apps/files_sharing/src/services/SharingService.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise<Folder | File | nu
7171
mtime = new Date((ocsEntry.stime) * 1000)
7272
}
7373

74+
let sharees: { sharee: object } | undefined
75+
if ('share_with' in ocsEntry) {
76+
sharees = {
77+
sharee: {
78+
id: ocsEntry.share_with,
79+
'display-name': ocsEntry.share_with_displayname || ocsEntry.share_with,
80+
type: ocsEntry.share_type,
81+
},
82+
}
83+
}
84+
7485
return new Node({
7586
id: fileid,
7687
source,
@@ -88,7 +99,8 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise<Folder | File | nu
8899
'owner-display-name': ocsEntry?.displayname_owner,
89100
'share-types': ocsEntry?.share_type,
90101
'share-attributes': ocsEntry?.attributes || '[]',
91-
favorite: ocsEntry?.tags?.includes((window.OC as Nextcloud.v29.OC & { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0,
102+
sharees,
103+
favorite: ocsEntry?.tags?.includes((window.OC as { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0,
92104
},
93105
})
94106
} catch (error) {

dist/9452-9452.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)