From 9e8dc41eceba5a1c928ee734d663cd5e67d3c00c Mon Sep 17 00:00:00 2001 From: cballevre Date: Fri, 18 Oct 2024 18:05:01 +0200 Subject: [PATCH] refactor(nextcloud): Convert helpers into Typescript --- src/modules/nextcloud/helpers.js | 18 ------------------ src/modules/nextcloud/helpers.ts | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 18 deletions(-) delete mode 100644 src/modules/nextcloud/helpers.js create mode 100644 src/modules/nextcloud/helpers.ts diff --git a/src/modules/nextcloud/helpers.js b/src/modules/nextcloud/helpers.js deleted file mode 100644 index 889324f483..0000000000 --- a/src/modules/nextcloud/helpers.js +++ /dev/null @@ -1,18 +0,0 @@ -import flag from 'cozy-flags' - -export const computeNextcloudFolderQueryId = ({ sourceAccount, path }) => { - return `io.cozy.remote.nextcloud.files/sourceAccount/${sourceAccount}/path${path}` -} - -/** - * Checks if the given file is a Nextcloud shortcut. - * - * @param {import('cozy-client/types/types').IOCozyFile} file - The file object to check. - * @returns {boolean} - Returns true if the file is a Nextcloud shortcut, false otherwise. - */ -export const isNextcloudShortcut = file => { - return ( - file.cozyMetadata?.createdByApp === 'nextcloud' && - flag('drive.show-nextcloud-dev') - ) -} diff --git a/src/modules/nextcloud/helpers.ts b/src/modules/nextcloud/helpers.ts new file mode 100644 index 0000000000..e342f3c34d --- /dev/null +++ b/src/modules/nextcloud/helpers.ts @@ -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') + ) +}