Merge pull request #839 from ente-io/fix-password-locked-public-collection-upload

fix password locked public collection upload
This commit is contained in:
Abhinav Kumar 2022-12-21 19:20:41 +05:30 committed by GitHub
commit d68019a934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View file

@ -177,7 +177,11 @@ export default function Uploader(props: Props) {
appContext.setIsFolderSyncRunning
);
}
}, []);
}, [
publicCollectionGalleryContext.accessedThroughSharedURL,
publicCollectionGalleryContext.token,
publicCollectionGalleryContext.passwordToken,
]);
// this handles the change of selectorFiles changes on web when user selects
// files for upload through the opened file/folder selector or dragAndDrop them

View file

@ -169,6 +169,9 @@ export default function PublicCollectionGallery() {
);
if (localCollection) {
setPublicCollection(localCollection);
const isPasswordProtected =
localCollection?.publicURLs?.[0]?.passwordEnabled;
setIsPasswordProtected(isPasswordProtected);
const collectionUID = getPublicCollectionUID(token.current);
const localFiles = await getLocalPublicFiles(collectionUID);
const localPublicFiles = sortFiles(
@ -229,6 +232,7 @@ export default function PublicCollectionGallery() {
const collectionUID = getPublicCollectionUID(token.current);
try {
appContext.startLoading();
setLoading(true);
const collection = await getPublicCollection(
token.current,
collectionKey.current
@ -291,6 +295,7 @@ export default function PublicCollectionGallery() {
}
} finally {
appContext.finishLoading();
setLoading(false);
}
};

View file

@ -62,6 +62,7 @@ class UploadManager {
publicCollectProps: PublicUploadProps
) {
UIService.init(progressUpdater);
UploadService.init(publicCollectProps);
this.setFiles = setFiles;
this.publicUploadProps = publicCollectProps;
}
@ -261,7 +262,6 @@ class UploadManager {
UIService.reset(mediaFiles.length);
UploadService.setPublicUploadProps(this.publicUploadProps);
await UploadService.setFileCount(mediaFiles.length);
UIService.setUploadStage(UPLOAD_STAGES.UPLOADING);

View file

@ -50,7 +50,7 @@ class UploadService {
private publicUploadProps: PublicUploadProps = undefined;
setPublicUploadProps(publicUploadProps: PublicUploadProps) {
init(publicUploadProps: PublicUploadProps) {
this.publicUploadProps = publicUploadProps;
}