From 5cec42206c91f10a5e42e4133c73ad30e83f35a4 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 2 Nov 2022 15:24:18 +0530 Subject: [PATCH] add collection should not be hidden check --- src/services/fileService.ts | 5 +++++ src/utils/error/index.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/src/services/fileService.ts b/src/services/fileService.ts index a519f807d..c78f2169c 100644 --- a/src/services/fileService.ts +++ b/src/services/fileService.ts @@ -18,6 +18,8 @@ import { SetFiles } from 'types/gallery'; import { MAX_TRASH_BATCH_SIZE } from 'constants/file'; import { BulkUpdateMagicMetadataRequest } from 'types/magicMetadata'; import { addLogLine } from 'utils/logging'; +import { isCollectionHidden } from 'utils/collection'; +import { CustomError } from 'utils/error'; const ENDPOINT = getEndpoint(); const FILES_TABLE = 'files'; @@ -63,6 +65,9 @@ export const syncFiles = async ( if (!getToken()) { continue; } + if (isCollectionHidden(collection)) { + throw CustomError.HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED; + } const lastSyncTime = await getCollectionLastSyncTime(collection); if (collection.updationTime === lastSyncTime) { continue; diff --git a/src/utils/error/index.ts b/src/utils/error/index.ts index 9d08e0ca7..6da8d1c9d 100644 --- a/src/utils/error/index.ts +++ b/src/utils/error/index.ts @@ -47,6 +47,7 @@ export enum CustomError { INCORRECT_PASSWORD = 'incorrect password', UPLOAD_CANCELLED = 'upload cancelled', REQUEST_TIMEOUT = 'request taking too long', + HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED = 'hidden collection sync file attempted', } function parseUploadErrorCodes(error) {