Skip to content

Commit 7bbc428

Browse files
committed
fix(files): use isDownloadable for isSyncable
Signed-off-by: John Molakvoæ <[email protected]>
1 parent a7509ae commit 7bbc428

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

apps/files/src/utils/permissions.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,21 @@ export function isDownloadable(node: Node): boolean {
3737
return true
3838
}
3939

40-
4140
/**
4241
* Check permissions on the node if it can be synced/open locally
4342
*
4443
* @param node The node to check
4544
* @return True if syncable, false otherwise
4645
*/
4746
export function isSyncable(node: Node): boolean {
48-
if ((node.permissions & Permission.UPDATE) === 0) {
47+
if (!node.isDavResource) {
4948
return false
5049
}
5150

52-
// check hide-download property of shares
53-
if (node.attributes['hide-download'] === true
54-
|| node.attributes['hide-download'] === 'true'
55-
) {
51+
if ((node.permissions & Permission.UPDATE) === 0) {
5652
return false
5753
}
5854

59-
// If the mount type is a share, ensure it got download permissions.
60-
if (node.attributes['share-attributes']) {
61-
const shareAttributes = JSON.parse(node.attributes['share-attributes'] || '[]') as Array<ShareAttribute>
62-
const downloadAttribute = shareAttributes.find(({ scope, key }: ShareAttribute) => scope === 'permissions' && key === 'download')
63-
if (downloadAttribute !== undefined) {
64-
return downloadAttribute.value === true
65-
}
66-
}
67-
68-
return true
69-
}
55+
// Syncable has the same permissions as downloadable for now
56+
return isDownloadable(node)
57+
}

0 commit comments

Comments
 (0)