Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rearrange

Manav Rathi5d553afea740
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 12aaf0f4e7..469ef5521f 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -303,6 +303,7 @@ const PhotoFrame = ({
const handleSelect = handleSelectCreator(
setSelected,
mode,
+ galleryContext.user?.id,
activeCollectionID,
activePersonID,
setRangeStart,
@@ -329,16 +330,9 @@ const PhotoFrame = ({
(index - i) * direction > 0;
i += direction
) {
- handleSelect(
- displayFiles[i].id,
- displayFiles[i].ownerID === galleryContext.user?.id,
- )(!checked);
+ handleSelect(displayFiles[i])(!checked);
}
- handleSelect(
- displayFiles[index].id,
- displayFiles[index].ownerID === galleryContext.user?.id,
- index,
- )(!checked);
+ handleSelect(displayFiles[index], index)(!checked);
}
};
@@ -353,11 +347,7 @@ const PhotoFrame = ({
updateURL={updateThumbURL(index)}
onClick={onThumbnailClick(index)}
selectable={selectable}
- onSelect={handleSelect(
- item.id,
- item.ownerID === galleryContext.user?.id,
- index,
- )}
+ onSelect={handleSelect(item, index)}
selected={
(!mode
? selected.collectionID === activeCollectionID
diff --git a/web/apps/photos/src/components/PhotoList/index.tsx b/web/apps/photos/src/components/PhotoList/index.tsx
index da1519d58a..783c26cbe8 100644
--- a/web/apps/photos/src/components/PhotoList/index.tsx
+++ b/web/apps/photos/src/components/PhotoList/index.tsx
@@ -796,6 +796,7 @@ export function PhotoList({
const handleSelect = handleSelectCreator(
galleryContext.setSelectedFiles,
mode,
+ galleryContext?.user?.id,
activeCollectionID,
activePersonID,
);
@@ -828,10 +829,7 @@ export function PhotoList({
console.time("c3");
filesOnADay.forEach((file) => {
- handleSelect(
- file.id,
- file.ownerID === galleryContext?.user?.id,
- )(isDateSelected);
+ handleSelect(file)(isDateSelected);
});
console.timeEnd("c3");
diff --git a/web/apps/photos/src/utils/photoFrame/index.ts b/web/apps/photos/src/utils/photoFrame/index.ts
index aff8c83512..8fdc03622a 100644
--- a/web/apps/photos/src/utils/photoFrame/index.ts
+++ b/web/apps/photos/src/utils/photoFrame/index.ts
@@ -6,11 +6,12 @@ export const handleSelectCreator =
(
setSelected: SetSelectedState,
mode: GalleryBarMode | undefined,
+ userID: number | undefined,
activeCollectionID: number,
activePersonID: string | undefined,
setRangeStart?,
) =>
- (id: number, isOwnFile: boolean, index?: number) =>
+ ({ id, ownerID }: { id: number; ownerID: number }, index?: number) =>
(checked: boolean) => {
if (typeof index !== "undefined") {
if (checked) {
@@ -110,7 +111,7 @@ export const handleSelectCreator =
};
const handleAllCounterChange = () => {
- if (isOwnFile) {
+ if (ownerID === userID) {
return {
ownCount: handleCounterChange(selected.ownCount),
count: handleCounterChange(selected.count),