Skip to content

armgit / ente

Public Imported from GitHub
0

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

Filter album selectors to only show shared albums

Anand Baburajanc6c1df1e60db
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index c7d44fcfe9..779953943e 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -445,20 +445,24 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
return fileNormalCollectionIDs?.get(file.id) ?? [];
}, [file, fileNormalCollectionIDs]);
- // Build collection info list with comment counts and cover files
+ // Build collection info list with comment counts and cover files (shared albums only)
const collectionsInfo = useMemo((): CollectionInfo[] => {
- return fileCollectionIDs.map((collectionID) => {
- const summary = collectionSummaries?.get(collectionID);
- return {
- id: collectionID,
- name: summary?.name ?? `Album ${collectionID}`,
- commentCount:
- commentsByCollection
- .get(collectionID)
- ?.filter((c) => !c.isDeleted).length ?? 0,
- coverFile: summary?.coverFile,
- };
- });
+ return fileCollectionIDs
+ .filter((collectionID) =>
+ collectionSummaries?.get(collectionID)?.attributes.has("shared"),
+ )
+ .map((collectionID) => {
+ const summary = collectionSummaries?.get(collectionID);
+ return {
+ id: collectionID,
+ name: summary?.name ?? `Album ${collectionID}`,
+ commentCount:
+ commentsByCollection
+ .get(collectionID)
+ ?.filter((c) => !c.isDeleted).length ?? 0,
+ coverFile: summary?.coverFile,
+ };
+ });
}, [fileCollectionIDs, collectionSummaries, commentsByCollection]);
// Collections sorted by comment count (descending) for dropdown
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 5acb8c4403..2258986b43 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -896,9 +896,11 @@ export const FileViewer: React.FC<FileViewerProps> = ({
existingReactions.map((r) => r.collectionId),
);
- // Filter to only collections not already liked
+ // Filter to only shared collections not already liked
const collectionsToLike = collectionIDs.filter(
- (id) => !likedCollectionIDs.has(id),
+ (id) =>
+ !likedCollectionIDs.has(id) &&
+ collectionSummaries?.get(id)?.attributes.has("shared"),
);
void (async () => {
@@ -945,7 +947,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
}
})();
setOpenLikeAlbumSelector(false);
- }, [fileNormalCollectionIDs, getUserFileReactions, user?.id]);
+ }, [fileNormalCollectionIDs, getUserFileReactions, user?.id, collectionSummaries]);
const handlePublicLikeModalClose = useCallback(
() => setOpenPublicLikeModal(false),