Skip to content

armgit / ente

Public Imported from GitHub
0

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

ctx

Manav Rathib7cd55aec3e3
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index b2021fa92c..5581cac124 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -86,12 +86,21 @@ export interface CollectionUser {
id: number;
/**
* The email of the user.
+ *
+ * - The email is present for the {@link owner} only for shared collections.
+ * - The email is present for all {@link sharees}.
+ * - Remote uses a blank string to indicate absent values.
*/
- email: string;
+ email?: string;
/**
* The association / privilege level of the user with the collection.
+ *
+ * - The role is not present blank for the {@link owner}.
+ * - The role is present, and one of "VIEWER" and "COLLABORATOR" for the
+ * {@link sharees}.
+ * - Remote uses a blank string to indicate absent values.
*/
- role: CollectionUserRole;
+ role?: CollectionUserRole;
}
export interface EncryptedCollection {
diff --git a/web/packages/new/photos/components/gallery/helpers.ts b/web/packages/new/photos/components/gallery/helpers.ts
index fde1b89526..afce9688d9 100644
--- a/web/packages/new/photos/components/gallery/helpers.ts
+++ b/web/packages/new/photos/components/gallery/helpers.ts
@@ -52,7 +52,7 @@ export const constructUserIDToEmailMap = (
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (sharees) {
sharees.forEach((item) => {
- if (item.id !== user.id)
+ if (item.id !== user.id && item.email)
userIDToEmailMap.set(item.id, item.email);
});
}
@@ -78,10 +78,11 @@ export const createShareeSuggestionEmails = (
// type for Collection.
//
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- return (sharees ?? []).map((sharee) => sharee.email);
+ return (sharees ?? []).map(({ email }) => email);
}
})
- .flat();
+ .flat()
+ .filter((e) => e !== undefined);
// Add family members.
if (familyData) {
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 6881274c0d..891b972cfa 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1442,7 +1442,7 @@ const createCollectionSummaries = (
// particular favorite as a prefix to disambiguate this collection
// from the user's own favorites.
// TODO(FAV): localize
- const initial = collection.owner.email.at(0)?.toUpperCase();
+ const initial = collection.owner.email?.at(0)?.toUpperCase();
if (initial) {
// TODO(FAV):
// name = `${initial}'s ${t("favorites")}`;