Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):align-album-sidebar-filters-with-mobile

Aswin Asokbdfda7f7e9cd
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index beea906b0b..7f1a0afb1c 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -284,7 +284,8 @@ export const GalleryBarAndListHeader: React.FC<
onShowAllPeople={showAllPeople}
collectionSummaries={sortedCollectionSummaries.filter((cs) =>
mode == "albums"
- ? !cs.attributes.has("system")
+ ? !cs.attributes.has("system") ||
+ (cs.id > 0 && cs.type == "uncategorized")
: !cs.attributes.has("hideFromCollectionBar") &&
!cs.attributes.has("quickLink"),
)}
diff --git a/web/apps/photos/src/components/gallery/BarImpl.tsx b/web/apps/photos/src/components/gallery/BarImpl.tsx
index bb4cd589f4..1fe66a027c 100644
--- a/web/apps/photos/src/components/gallery/BarImpl.tsx
+++ b/web/apps/photos/src/components/gallery/BarImpl.tsx
@@ -96,11 +96,7 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
);
const visibleAlbumFilters = useMemo(
() =>
- getVisibleAlbumFilters(
- collectionSummaries.filter(
- (cs) => !cs.attributes.has("system"),
- ),
- ).map((filter) =>
+ getVisibleAlbumFilters(collectionSummaries).map((filter) =>
filter.value == "all"
? {
value: "ente" as const,
diff --git a/web/apps/photos/src/utils/album-filters.ts b/web/apps/photos/src/utils/album-filters.ts
index 9b4935a9cb..d497edd9b1 100644
--- a/web/apps/photos/src/utils/album-filters.ts
+++ b/web/apps/photos/src/utils/album-filters.ts
@@ -44,22 +44,25 @@ export const matchesAlbumFilter = (
return true;
case "ente":
return (
- cs.fileCount > 0 &&
!cs.attributes.has("system") &&
- !cs.attributes.has("shared") &&
- !matchesAlbumFilter(cs, "shared") &&
- !matchesAlbumFilter(cs, "received") &&
- !matchesAlbumFilter(cs, "links")
+ !cs.attributes.has("uncategorized") &&
+ !cs.attributes.has("quickLink") &&
+ !cs.attributes.has("archived") &&
+ !(cs.type == "userFavorites" && cs.fileCount == 0)
);
case "shared":
return (
+ !cs.attributes.has("archived") &&
!cs.attributes.has("sharedIncoming") &&
!cs.attributes.has("quickLink") &&
(cs.attributes.has("sharedOutgoing") ||
cs.attributes.has("sharedViaLink"))
);
case "received":
- return cs.attributes.has("sharedIncoming");
+ return (
+ !cs.attributes.has("archived") &&
+ cs.attributes.has("sharedIncoming")
+ );
case "links":
return cs.attributes.has("quickLink");
case "empty-albums":
diff --git a/web/apps/photos/tests/album-filters.test.ts b/web/apps/photos/tests/album-filters.test.ts
index ee3d9d3d74..72bf364148 100644
--- a/web/apps/photos/tests/album-filters.test.ts
+++ b/web/apps/photos/tests/album-filters.test.ts
@@ -26,7 +26,7 @@ const album = (
});
describe("album filters shared by the dialog and sidebar", () => {
- test("Ente contains non-empty local albums outside the other categories", () => {
+ test("Ente matches mobile membership, including shared, received, and empty albums", () => {
const albums = [
album(1),
{ ...album(2, ["userFavorites"]), type: "userFavorites" as const },
@@ -38,15 +38,38 @@ describe("album filters shared by the dialog and sidebar", () => {
album(8, ["archived"], 0),
album(9, ["system"]),
album(10, ["shared"]),
+ {
+ ...album(11, ["userFavorites"], 0),
+ type: "userFavorites" as const,
+ },
+ {
+ ...album(12, ["sharedIncoming", "favorites"], 0),
+ type: "sharedIncoming" as const,
+ },
+ album(13, ["sharedIncoming", "uncategorized"]),
+ {
+ ...album(
+ 14,
+ ["system", "uncategorized", "sharedOutgoing", "shared"],
+ 0,
+ ),
+ type: "uncategorized" as const,
+ },
+ album(15, ["sharedOutgoing", "shared", "archived"]),
+ album(16, ["sharedIncoming", "shared", "archived"]),
];
expect(
albums
.filter((cs) => matchesAlbumFilter(cs, "ente"))
.map(({ id }) => id),
- ).toEqual([1, 2]);
+ ).toEqual([1, 2, 3, 4, 5, 7, 10, 12]);
+ expect(matchesAlbumFilter(albums[13]!, "shared")).toBe(true);
+ expect(matchesAlbumFilter(albums[12]!, "received")).toBe(true);
+ expect(matchesAlbumFilter(albums[14]!, "shared")).toBe(false);
+ expect(matchesAlbumFilter(albums[15]!, "received")).toBe(false);
expect(
albums.filter((cs) => matchesAlbumFilter(cs, "all")),
- ).toHaveLength(10);
+ ).toHaveLength(16);
});
test("separates outgoing sharing, incoming sharing, and quick links", () => {