add collection should not be hidden check

This commit is contained in:
Abhinav 2022-11-02 15:24:18 +05:30
parent 19544abdcb
commit 5cec42206c
2 changed files with 6 additions and 0 deletions

View file

@ -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;

View file

@ -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) {