Merge branch 'master' into remove-file-from-collection

This commit is contained in:
abhinav-grd 2021-09-28 14:03:39 +05:30
commit 2ef41995c8
2 changed files with 8 additions and 10 deletions

View file

@ -327,11 +327,10 @@ export default function Gallery() {
setCollectionSelectorView,
selected,
files,
clearSelection,
syncWithRemote,
setActiveCollection,
collection
);
clearSelection();
} catch (e) {
setDialogMessage({
title: constants.ERROR,
@ -339,6 +338,9 @@ export default function Gallery() {
close: { variant: 'danger' },
content: constants.UNKNOWN_ERROR,
});
} finally {
await syncWithRemote(false, true);
loadingBar.current.complete();
}
};
@ -353,6 +355,7 @@ export default function Gallery() {
visibility
);
await updateMagicMetadata(updatedFiles);
clearSelection();
} catch (e) {
switch (e.status?.toString()) {
case ServerErrorCodes.FORBIDDEN:
@ -371,8 +374,7 @@ export default function Gallery() {
content: constants.UNKNOWN_ERROR,
});
} finally {
clearSelection();
syncWithRemote();
await syncWithRemote(false, true);
loadingBar.current.complete();
}
};
@ -412,6 +414,7 @@ export default function Gallery() {
const fileIds = getSelectedFileIds(selected);
await deleteFiles(fileIds);
setDeleted([...deleted, ...fileIds]);
clearSelection();
} catch (e) {
switch (e.status?.toString()) {
case ServerErrorCodes.FORBIDDEN:
@ -429,8 +432,7 @@ export default function Gallery() {
content: constants.UNKNOWN_ERROR,
});
} finally {
clearSelection();
syncWithRemote();
await syncWithRemote(false, true);
loadingBar.current.complete();
}
};

View file

@ -21,8 +21,6 @@ export async function handleCollectionOps(
setCollectionSelectorView: (value: boolean) => void,
selected: SelectedState,
files: File[],
clearSelection: () => void,
syncWithRemote: () => Promise<void>,
setActiveCollection: (id: number) => void,
collection: Collection
) {
@ -45,8 +43,6 @@ export async function handleCollectionOps(
default:
throw Error(CustomError.INVALID_COLLECTION_OPERATION);
}
clearSelection();
await syncWithRemote();
setActiveCollection(collection.id);
}