Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prune

Manav Rathiff06c4d1cf5e
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 22cd033f81..98fc6d5329 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -976,18 +976,13 @@ export const deriveFilteredFilesAlbumFocus = (state: GalleryState) => {
(collection) => collection.id === activeCollectionID,
);
- const filteredFiles = files.filter((item) => {
- if (tempDeletedFileIDs.has(item.id)) {
- return false;
- }
-
- if (tempHiddenFileIDs.has(item.id)) {
- return false;
- }
+ const filteredFiles = files.filter((file) => {
+ if (tempDeletedFileIDs.has(file.id)) return false;
+ if (tempHiddenFileIDs.has(file.id)) return false;
// archived collections files can only be seen in their respective collection
- if (archivedCollectionIDs.has(item.collectionID)) {
- if (activeCollectionID === item.collectionID) {
+ if (archivedCollectionIDs.has(file.collectionID)) {
+ if (activeCollectionID === file.collectionID) {
return true;
} else {
return false;
@@ -995,10 +990,10 @@ export const deriveFilteredFilesAlbumFocus = (state: GalleryState) => {
}
// Archived files can only be seen in archive section or their respective collection
- if (isArchivedFile(item)) {
+ if (isArchivedFile(file)) {
if (
activeCollectionID === ARCHIVE_SECTION ||
- activeCollectionID === item.collectionID
+ activeCollectionID === file.collectionID
) {
return true;
} else {
@@ -1009,19 +1004,15 @@ export const deriveFilteredFilesAlbumFocus = (state: GalleryState) => {
// ALL SECTION - show all files
if (activeCollectionID === ALL_SECTION) {
// show all files except the ones in hidden collections
- if (hiddenFileIDs.has(item.id)) {
+ if (hiddenFileIDs.has(file.id)) {
return false;
} else {
return true;
}
}
- // COLLECTION SECTION - show files in the active collection
- if (activeCollectionID === item.collectionID) {
- return true;
- } else {
- return false;
- }
+ // Show files in the active collection
+ return activeCollectionID === file.collectionID;
});
return sortAndUniqueFilteredFiles(filteredFiles, activeCollection);
};
@@ -1044,14 +1035,12 @@ export const deriveFilteredFilesHiddenAlbumsFocus = (state: GalleryState) => {
(collection) => collection.id === activeCollectionID,
);
- const filteredFiles = hiddenFiles.filter((item) => {
- if (tempDeletedFileIDs.has(item.id)) {
- return false;
- }
+ const filteredFiles = hiddenFiles.filter((file) => {
+ if (tempDeletedFileIDs.has(file.id)) return false;
// archived collections files can only be seen in their respective collection
- if (archivedCollectionIDs.has(item.collectionID)) {
- if (activeCollectionID === item.collectionID) {
+ if (archivedCollectionIDs.has(file.collectionID)) {
+ if (activeCollectionID === file.collectionID) {
return true;
} else {
return false;
@@ -1061,29 +1050,13 @@ export const deriveFilteredFilesHiddenAlbumsFocus = (state: GalleryState) => {
// HIDDEN ITEMS SECTION - show all individual hidden files
if (
activeCollectionID === HIDDEN_ITEMS_SECTION &&
- defaultHiddenCollectionIDs.has(item.collectionID)
+ defaultHiddenCollectionIDs.has(file.collectionID)
) {
return true;
}
- // Archived files can only be seen in archive section or their respective collection
- if (isArchivedFile(item)) {
- if (
- activeCollectionID === ARCHIVE_SECTION ||
- activeCollectionID === item.collectionID
- ) {
- return true;
- } else {
- return false;
- }
- }
-
- // COLLECTION SECTION - show files in the active collection
- if (activeCollectionID === item.collectionID) {
- return true;
- } else {
- return false;
- }
+ // Show files in the active collection
+ return activeCollectionID === file.collectionID;
});
return sortAndUniqueFilteredFiles(filteredFiles, activeCollection);
@@ -1093,10 +1066,9 @@ export const deriveFilteredFilesHiddenAlbumsFocus = (state: GalleryState) => {
* Prepare the list of files for being shown in the gallery.
*
* This functions uniques the given collection files so that there is only one
- * entry per file ID. Then it sorts them if needed if the active collection
- * prefers them to be sorted oldest first (by default, lists of collection files
- * are sorted newest first, and we assume that {@link files} are already sorted
- * that way).
+ * entry per file ID. Then it sorts them if the active collection prefers them
+ * to be sorted oldest first (by default, lists of collection files are sorted
+ * newest first, and we assume that {@link files} are already sorted that way).
*/
const sortAndUniqueFilteredFiles = (
files: EnteFile[],