Skip to content

Commit c5d5933

Browse files
authored
Merge pull request #50934 from nextcloud/backport/50918/stable30
[stable30] fix(files_sharing): Map sharee information for `shared-by-you` view
2 parents 841cad5 + 091605a commit c5d5933

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
@@ -342,6 +342,13 @@ describe('SharingService share to Node mapping', () => {
342342
expect(file.root).toBe('/files/test')
343343
expect(file.attributes).toBeInstanceOf(Object)
344344
expect(file.attributes['has-preview']).toBe(true)
345+
expect(file.attributes.sharees).toEqual({
346+
sharee: {
347+
id: 'user00',
348+
'display-name': 'User00',
349+
type: 0,
350+
},
351+
})
345352
expect(file.attributes.favorite).toBe(0)
346353
})
347354

apps/files_sharing/src/services/SharingService.ts

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

72+
let sharees: { sharee: object } | undefined
73+
if ('share_with' in ocsEntry) {
74+
sharees = {
75+
sharee: {
76+
id: ocsEntry.share_with,
77+
'display-name': ocsEntry.share_with_displayname || ocsEntry.share_with,
78+
type: ocsEntry.share_type,
79+
},
80+
}
81+
}
82+
7283
return new Node({
7384
id: fileid,
7485
source,
@@ -86,7 +97,8 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise<Folder | File | nu
8697
'owner-display-name': ocsEntry?.displayname_owner,
8798
'share-types': ocsEntry?.share_type,
8899
'share-attributes': ocsEntry?.attributes || '[]',
89-
favorite: ocsEntry?.tags?.includes((window.OC as Nextcloud.v29.OC & { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0,
100+
sharees,
101+
favorite: ocsEntry?.tags?.includes((window.OC as { TAG_FAVORITE: string }).TAG_FAVORITE) ? 1 : 0,
90102
},
91103
})
92104
} catch (error) {

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