Skip to content

armgit / ente

Public Imported from GitHub
0

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

case

Manav Rathi15daa9e453df
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 632996cd23..21285e5abc 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -344,7 +344,7 @@ const CollectionOptions: React.FC<CollectionHeaderProps> = ({
onClick={onCollectionShare}
startIcon={<PeopleIcon />}
>
- {/*TODO(RE):*/ pt("Share favorites")}
+ {/*TODO(FAV):*/ pt("Share favorites")}
</OverflowMenuOption>
</>
) : collectionSummaryType == "uncategorized" ? (
@@ -513,7 +513,7 @@ const ShareQuickOption: React.FC<ShareQuickOptionProps> = ({
collectionSummaryType == "sharedOnlyViaLink"
? t("modify_sharing")
: collectionSummaryType == "favorites"
- ? /*TODO(RE):*/ pt("Share favorites")
+ ? /*TODO(FAV):*/ pt("Share favorites")
: t("share_album")
}
>
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index c69c4d433e..4ef93d5c0b 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1223,6 +1223,7 @@ const deriveFavoriteFileIDs = (
) => {
let favoriteFileIDs = new Set<number>();
for (const collection of collections) {
+ // See: [Note: User and shared favorites]
if (collection.type == "favorites" && collection.owner.id == user.id) {
favoriteFileIDs = new Set(
files
@@ -1367,6 +1368,19 @@ const createCollectionSummaries = (
} else if (isPinnedCollection(collection)) {
type = "pinned";
} else {
+ // [Note: User and shared favorites]
+ //
+ // "favorites" can be both the user's own favorites, or favorites of
+ // other users shared with them. However, all of the latter will get
+ // typed as "incomingShareViewer" or "incomingShareCollaborator" in
+ // the first case above. So if a collection summary has type
+ // "favorites", it is guaranteed to be the user's own favorites.
+ //
+ // However, the type of the _collection_ itself is not changed, so
+ // whenever we're checking the type of the collection (not of the
+ // collection summary) and we specifically want to target the user's
+ // own favorites, we also need to check the collection owner's ID is
+ // the same as the logged in user's ID.
type = collection.type;
}
@@ -1404,6 +1418,19 @@ const createCollectionSummaries = (
name = t("section_uncategorized");
} else if (type == "favorites") {
name = t("favorites");
+ } else if (collection.type == "favorites") {
+ // See: [Note: User and shared favorites] above.
+ //
+ // Use the first letter of the email of the user who shared this
+ // 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();
+ if (initial) {
+ name = `${initial}'s {t("favorites")}`;
+ } else {
+ name = `Shared {t("favorites")}`;
+ }
} else {
name = collection.name;
}