This commit is contained in:
Manav Rathi
2025-06-27 16:37:19 +05:30
parent 61fb167cec
commit 7af11786fb
4 changed files with 17 additions and 19 deletions

View File

@@ -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",

View File

@@ -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"}
/>

View File

@@ -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"

View File

@@ -22,6 +22,7 @@ export type CollectionSummaryAttribute =
| "defaultHidden"
| "shared"
| "outgoingShare"
| "sharedIncoming"
| "incomingShareViewer"
| "incomingShareCollaborator"
| "sharedOnlyViaLink"