Skip to content

Commit

Permalink
refactor(nextcloud): Convert helpers into Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Oct 22, 2024
1 parent b86d3e4 commit 9e8dc41
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/modules/nextcloud/helpers.js

This file was deleted.

25 changes: 25 additions & 0 deletions src/modules/nextcloud/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { IOCozyFile } from 'cozy-client/types/types'
import flag from 'cozy-flags'

export const computeNextcloudFolderQueryId = ({
sourceAccount,
path
}: {
sourceAccount: string
path: string
}): string => {
return `io.cozy.remote.nextcloud.files/sourceAccount/${sourceAccount}/path${path}`
}

/**
* Checks if the given file is a Nextcloud shortcut.
*
* @param file - The file object to check.
* @returns - Returns true if the file is a Nextcloud shortcut, false otherwise.
*/
export const isNextcloudShortcut = (file: IOCozyFile): boolean => {
return (
file.cozyMetadata?.createdByApp === 'nextcloud' &&
flag('drive.show-nextcloud-dev')
)
}

0 comments on commit 9e8dc41

Please sign in to comment.