Skip to content

armgit / ente

Public Imported from GitHub
0

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

+attr

Manav Rathie9fd33890e7e
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 0f76028e8b..37da3b9adc 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1232,6 +1232,46 @@ const createCollectionSummaries = (
}
}
+ // This block of code duplicates the above. Such duplication is needed
+ // until type is completely replaced by attributes.
+ const attributes: CollectionSummaryType[] = [];
+ if (isIncomingShare(collection, user)) {
+ if (isIncomingCollabShare(collection, user)) {
+ attributes.push("incomingShareCollaborator");
+ } else {
+ attributes.push("incomingShareViewer");
+ }
+ }
+ if (isOutgoingShare(collection, user)) {
+ attributes.push("outgoingShare");
+ }
+ if (isSharedOnlyViaLink(collection)) {
+ attributes.push("sharedOnlyViaLink");
+ }
+ if (isArchivedCollection(collection)) {
+ attributes.push("archived");
+ }
+ if (isDefaultHiddenCollection(collection)) {
+ attributes.push("defaultHidden");
+ }
+ if (isPinnedCollection(collection)) {
+ attributes.push("pinned");
+ }
+ switch (collection.type) {
+ case CollectionType.folder:
+ attributes.push("folder");
+ break;
+ case CollectionType.favorites:
+ attributes.push("favorites");
+ break;
+ case CollectionType.album:
+ attributes.push("album");
+ break;
+ case CollectionType.uncategorized:
+ attributes.push("uncategorized");
+ break;
+ }
+
let name: string;
if (type == "uncategorized") {
name = t("section_uncategorized");
diff --git a/web/packages/new/photos/services/collection/ui.ts b/web/packages/new/photos/services/collection/ui.ts
index e4e4498d7f..6b9340def6 100644
--- a/web/packages/new/photos/services/collection/ui.ts
+++ b/web/packages/new/photos/services/collection/ui.ts
@@ -37,8 +37,16 @@ export interface CollectionSummary {
id: number;
/**
* The "UI" type for the collection or pseudo-collection.
+ *
+ * For newer code consider using {@link attributes} instead.
*/
type: CollectionSummaryType;
+ /**
+ * Various UI related attributes for the collection or pseudo-collection.
+ *
+ * This is meant to replace {@link type} gradually.
+ */
+ attributes: CollectionSummaryType[];
/**
* The name of the collection or pseudo-collection.
*/