Skip to content

armgit / ente

Public Imported from GitHub
0

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

attr

Manav Rathi7af11786fb14
diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
index 6be0160d18..5a9ce14662 100644
--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
@@ -17,7 +17,10 @@ import { useBaseContext } from "ente-base/context";
import type { Collection } from "ente-media/collection";
import type { CollectionSelectorAttributes } from "ente-new/photos/components/CollectionSelector";
import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
-import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";
+import {
+ PseudoCollectionID,
+ type CollectionSummary,
+} from "ente-new/photos/services/collection-summary";
import { t } from "i18next";
import { type CollectionOp } from "utils/collection";
import { type FileOp } from "utils/file";
@@ -40,8 +43,6 @@ interface Props {
clearSelection: () => void;
barMode?: GalleryBarMode;
activeCollectionID: number;
- isFavoriteCollection: boolean;
- isUncategorizedCollection: boolean;
/**
* TODO: Need to implement delete-equivalent from shared albums.
*
@@ -63,7 +64,7 @@ interface Props {
* Also note that that user cannot delete files that are not owned by the
* user, even if they are in an album owned by the user.
*/
- isIncomingSharedCollection: boolean;
+ activeCollectionSummary: CollectionSummary | undefined;
isInSearchMode: boolean;
selectedCollection: Collection;
isInHiddenSection: boolean;
@@ -80,9 +81,7 @@ const SelectedFileOptions = ({
clearSelection,
barMode,
activeCollectionID,
- isFavoriteCollection,
- isUncategorizedCollection,
- isIncomingSharedCollection,
+ activeCollectionSummary,
isInSearchMode,
isInHiddenSection,
}: Props) => {
@@ -90,6 +89,14 @@ const SelectedFileOptions = ({
const peopleMode = barMode == "people";
+ const isFavoriteCollection = activeCollectionSummary?.type == "favorites";
+
+ const isUncategorizedCollection =
+ activeCollectionSummary?.type == "uncategorized";
+
+ const isIncomingSharedCollection =
+ activeCollectionSummary?.attributes.has("sharedIncoming");
+
const addToCollection = () =>
onOpenCollectionSelector({
action: "add",
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index d98776cd9c..4bfd515381 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -934,18 +934,7 @@ const Page: React.FC = () => {
selected.collectionID,
state.collections,
)}
- isFavoriteCollection={
- activeCollectionSummary?.type == "favorites"
- }
- isUncategorizedCollection={
- activeCollectionSummary?.type == "uncategorized"
- }
- isIncomingSharedCollection={
- activeCollectionSummary?.type ==
- "incomingShareCollaborator" ||
- activeCollectionSummary?.type ==
- "incomingShareViewer"
- }
+ activeCollectionSummary={activeCollectionSummary}
isInSearchMode={isInSearchMode}
isInHiddenSection={barMode == "hidden-albums"}
/>
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index a4a41f8d49..e0c905b092 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1468,6 +1468,7 @@ const createCollectionSummaries = (
const attributes = new Set<CollectionSummaryAttribute>();
if (collection.owner.id != user.id) {
attributes.add("shared");
+ attributes.add("sharedIncoming");
attributes.add(
collection.sharees.find((s) => s.id == user.id)?.role ==
"COLLABORATOR"
diff --git a/web/packages/new/photos/services/collection-summary.ts b/web/packages/new/photos/services/collection-summary.ts
index 46ea092163..38d7b89687 100644
--- a/web/packages/new/photos/services/collection-summary.ts
+++ b/web/packages/new/photos/services/collection-summary.ts
@@ -22,6 +22,7 @@ export type CollectionSummaryAttribute =
| "defaultHidden"
| "shared"
| "outgoingShare"
+ | "sharedIncoming"
| "incomingShareViewer"
| "incomingShareCollaborator"
| "sharedOnlyViaLink"