Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix missing negation

Manav Rathi84912c1a0eae
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 0fad18bef2..80b3400c29 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -551,7 +551,7 @@ export const Upload: React.FC<UploadProps> = ({
const preCollectionCreationAction = async () => {
props.onCloseCollectionSelector?.();
- props.setShouldDisableDropzone(!uploadManager.shouldAllowNewUpload());
+ props.setShouldDisableDropzone(uploadManager.isUploadInProgress());
setUploadPhase("preparing");
setUploadProgressView(true);
};
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index e08b346569..f807ba44f6 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -785,9 +785,7 @@ const Page: React.FC = () => {
};
const openUploader = (intent?: UploadTypeSelectorIntent) => {
- if (!uploadManager.shouldAllowNewUpload()) {
- return;
- }
+ if (uploadManager.isUploadInProgress()) return;
setUploadTypeSelectorView(true);
setUploadTypeSelectorIntent(intent ?? "upload");
};
@@ -1096,7 +1094,7 @@ const Page: React.FC = () => {
activeCollectionID === ALL_SECTION ? (
<GalleryEmptyState
openUploader={openUploader}
- shouldAllowNewUpload={uploadManager.shouldAllowNewUpload()}
+ isUploadInProgress={uploadManager.isUploadInProgress()}
/>
) : !isInSearchMode &&
!isFirstLoad &&
@@ -1218,7 +1216,7 @@ const SidebarButton: React.FC<ButtonishProps> = ({ onClick }) => (
);
const UploadButton: React.FC<ButtonishProps> = ({ onClick }) => {
- const disabled = !uploadManager.shouldAllowNewUpload();
+ const disabled = uploadManager.isUploadInProgress();
const isSmallWidth = useIsSmallWidth();
const icon = <FileUploadOutlinedIcon />;
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 61c3bca479..6452c1cc12 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -558,7 +558,7 @@ const EnteLogoLink = styled("a")(({ theme }) => ({
}));
const AddPhotosButton: React.FC<ButtonishProps> = ({ onClick }) => {
- const disabled = !uploadManager.shouldAllowNewUpload();
+ const disabled = uploadManager.isUploadInProgress();
const isSmallWidth = useIsSmallWidth();
const icon = <AddPhotoAlternateOutlinedIcon />;
@@ -585,7 +585,7 @@ const AddPhotosButton: React.FC<ButtonishProps> = ({ onClick }) => {
* shrink on mobile sized screens.
*/
const AddMorePhotosButton: React.FC<ButtonishProps> = ({ onClick }) => {
- const disabled = !uploadManager.shouldAllowNewUpload();
+ const disabled = uploadManager.isUploadInProgress();
return (
<FocusVisibleButton
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.ts
index c88c40bf1d..6cce6aaf43 100644
--- a/web/apps/photos/src/services/upload-manager.ts
+++ b/web/apps/photos/src/services/upload-manager.ts
@@ -682,8 +682,13 @@ class UploadManager {
this.onUploadFile(decryptedFile);
}
- public shouldAllowNewUpload = () => {
- return !this.uploadInProgress || watcher.isUploadRunning();
+ /**
+ * `true` if an upload is currently in-progress (either a bunch of files
+ * directly uploaded by the user, or files being uploaded by the folder
+ * watch functionality).
+ */
+ public isUploadInProgress = () => {
+ return this.uploadInProgress || watcher.isUploadRunning();
};
}
diff --git a/web/packages/new/photos/components/gallery/index.tsx b/web/packages/new/photos/components/gallery/index.tsx
index 6f65587431..aeafebf2fe 100644
--- a/web/packages/new/photos/components/gallery/index.tsx
+++ b/web/packages/new/photos/components/gallery/index.tsx
@@ -63,7 +63,7 @@ import { Trans } from "react-i18next";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
-export function GalleryEmptyState({ openUploader, shouldAllowNewUpload }) {
+export function GalleryEmptyState({ openUploader, isUploadInProgress }) {
return (
<Wrapper>
<Stack sx={{ flex: "none", paddingBlock: "12px 32px" }}>
@@ -102,7 +102,7 @@ export function GalleryEmptyState({ openUploader, shouldAllowNewUpload }) {
color="accent"
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
onClick={() => openUploader("upload")}
- disabled={!shouldAllowNewUpload}
+ disabled={isUploadInProgress}
sx={{ mt: 1.5, p: 1, width: 320, borderRadius: 0.5 }}
>
<FlexWrapper sx={{ gap: 1 }} justifyContent="center">
@@ -113,7 +113,7 @@ export function GalleryEmptyState({ openUploader, shouldAllowNewUpload }) {
<Button
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
onClick={() => openUploader("import")}
- disabled={!shouldAllowNewUpload}
+ disabled={isUploadInProgress}
sx={{ mt: 1.5, p: 1, width: 320, borderRadius: 0.5 }}
>
<FlexWrapper sx={{ gap: 1 }} justifyContent="center">