Skip to content

armgit / ente

Public Imported from GitHub
0

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

Hide join album button in public like/comment modals when disabled

Anand Baburajanf5c3cee2d663
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index 96cb7f0cd7..ba81af1836 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -129,6 +129,7 @@ export type FileListWithViewerProps = {
| "collectionKey"
| "onJoinAlbum"
| "enableComment"
+ | "enableJoin"
>;
/**
@@ -184,6 +185,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
collectionKey,
onJoinAlbum,
enableComment,
+ enableJoin,
}) => {
const [openFileViewer, setOpenFileViewer] = useState(false);
const [currentIndex, setCurrentIndex] = useState(0);
@@ -384,6 +386,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
collectionKey,
onJoinAlbum,
enableComment,
+ enableJoin,
}}
isCommentsFeatureEnabled={isCommentsEnabled}
onTriggerRemotePull={handleTriggerRemotePull}
diff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsx
index d894829f87..bd48fd3585 100644
--- a/web/apps/photos/src/components/TripLayout/index.tsx
+++ b/web/apps/photos/src/components/TripLayout/index.tsx
@@ -58,6 +58,11 @@ interface TripLayoutProps {
* When `false`, the feed button will be hidden.
*/
enableComment?: boolean;
+ /**
+ * `true` if the "Join album" option is enabled for this public link.
+ * When `false`, the "Join album and like/comment" buttons will be hidden.
+ */
+ enableJoin?: boolean;
}
export const TripLayout: React.FC<TripLayoutProps> = ({
@@ -73,6 +78,7 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
collectionKey,
credentials,
enableComment = true,
+ enableJoin = true,
}) => {
// Extract collection info if available
const collectionTitle = collection?.name || albumTitle || "Trip";
@@ -595,6 +601,7 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
collectionKey={collectionKey}
onJoinAlbum={handleJoinAlbum}
enableComment={enableComment}
+ enableJoin={enableJoin}
/>
{/* Download progress notifications */}
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 1f62e2eea6..bdbe456b8b 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -588,6 +588,7 @@ export default function PublicCollectionGallery() {
collectionKey={collectionKey.current}
credentials={credentials}
enableComment={commentsEnabled}
+ enableJoin={publicCollection?.publicURLs[0]?.enableJoin}
/>
) : (
<>
@@ -654,6 +655,7 @@ export default function PublicCollectionGallery() {
collectionKey={collectionKey.current}
onJoinAlbum={handleJoinAlbum}
enableComment={commentsEnabled}
+ enableJoin={publicCollection?.publicURLs[0]?.enableJoin}
pendingFileIndex={pendingFileNavigation?.fileIndex}
pendingFileSidebar={pendingFileNavigation?.sidebar}
pendingHighlightCommentID={
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index dede805b3e..6addd632ed 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -471,6 +471,11 @@ export interface CommentsSidebarProps extends ModalVisibilityProps {
* Should trigger the join album flow (with mobile deep link fallback).
*/
onJoinAlbum?: () => void;
+ /**
+ * Whether the "Join album" option is enabled for this public link.
+ * When false, the "Join album and like/comment" buttons will be hidden.
+ */
+ enableJoin?: boolean;
}
/**
@@ -502,6 +507,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
collectionKey,
anonUserNames,
onJoinAlbum,
+ enableJoin = true,
}) => {
const [commentText, setCommentText] = useState("");
const [replyingTo, setReplyingTo] = useState<Comment | null>(null);
@@ -2113,6 +2119,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
onClose={() => setShowPublicCommentModal(false)}
onCommentAnonymously={handleCommentAnonymously}
onJoinAlbumToComment={handleJoinAlbumToComment}
+ enableJoin={enableJoin}
/>
<PublicLikeModal
open={showPublicLikeModal}
@@ -2122,6 +2129,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
}}
onLikeAnonymously={handleLikeAnonymously}
onJoinAlbumToLike={handleJoinAlbumToLike}
+ enableJoin={enableJoin}
/>
<AddNameModal
open={showAddNameModal}
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 501348ae4b..896c0f516b 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -361,6 +361,14 @@ export type FileViewerProps = ModalVisibilityProps & {
* Defaults to `false`.
*/
isCommentsFeatureEnabled?: boolean;
+ /**
+ * `true` if the "Join album" option is enabled for this public link.
+ *
+ * When `false`, the "Join album and like/comment" button will be hidden
+ * in the public like/comment modals.
+ * Defaults to `true`.
+ */
+ enableJoin?: boolean;
} & Pick<
FileInfoProps,
"collectionNameByID" | "onSelectCollection" | "onSelectPerson"
@@ -405,6 +413,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
onJoinAlbum,
enableComment = true,
isCommentsFeatureEnabled = false,
+ enableJoin = true,
}) => {
const { onGenericError } = useBaseContext();
@@ -2555,6 +2564,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
collectionKey={collectionKey}
anonUserNames={anonUserNames}
onJoinAlbum={onJoinAlbum}
+ enableJoin={enableJoin}
/>
<LikesSidebar
open={openLikes}
@@ -2583,6 +2593,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
onClose={handlePublicLikeModalClose}
onLikeAnonymously={handleLikeAnonymously}
onJoinAlbumToLike={handleJoinAlbumToLike}
+ enableJoin={enableJoin}
/>
<AddNameModal
open={openAddNameModal}
diff --git a/web/packages/gallery/components/viewer/PublicCommentModal.tsx b/web/packages/gallery/components/viewer/PublicCommentModal.tsx
index 52b79441b5..988b910804 100644
--- a/web/packages/gallery/components/viewer/PublicCommentModal.tsx
+++ b/web/packages/gallery/components/viewer/PublicCommentModal.tsx
@@ -103,6 +103,11 @@ export interface PublicCommentModalProps extends ModalVisibilityProps {
* Called when user clicks "Join album and comment".
*/
onJoinAlbumToComment: () => void;
+ /**
+ * Whether the "Join album" option is enabled for this public link.
+ * When false, the "Join album and comment" button will be hidden.
+ */
+ enableJoin?: boolean;
}
/**
@@ -114,6 +119,7 @@ export const PublicCommentModal: React.FC<PublicCommentModalProps> = ({
onClose,
onCommentAnonymously,
onJoinAlbumToComment,
+ enableJoin = true,
}) => {
return (
<StyledDialog open={open} onClose={onClose}>
@@ -140,13 +146,15 @@ export const PublicCommentModal: React.FC<PublicCommentModalProps> = ({
>
{t("comment_anonymously")}
</AnonymousButton>
- <SignInButton
- variant="contained"
- fullWidth
- onClick={onJoinAlbumToComment}
- >
- {t("join_album_and_comment")}
- </SignInButton>
+ {enableJoin && (
+ <SignInButton
+ variant="contained"
+ fullWidth
+ onClick={onJoinAlbumToComment}
+ >
+ {t("join_album_and_comment")}
+ </SignInButton>
+ )}
</ButtonsSection>
</ContentContainer>
</DialogWrapper>
diff --git a/web/packages/gallery/components/viewer/PublicLikeModal.tsx b/web/packages/gallery/components/viewer/PublicLikeModal.tsx
index 85351730a7..1ca4776324 100644
--- a/web/packages/gallery/components/viewer/PublicLikeModal.tsx
+++ b/web/packages/gallery/components/viewer/PublicLikeModal.tsx
@@ -91,6 +91,11 @@ export interface PublicLikeModalProps extends ModalVisibilityProps {
* Called when user clicks "Join album to like".
*/
onJoinAlbumToLike: () => void;
+ /**
+ * Whether the "Join album" option is enabled for this public link.
+ * When false, the "Join album and like" button will be hidden.
+ */
+ enableJoin?: boolean;
}
/**
@@ -102,6 +107,7 @@ export const PublicLikeModal: React.FC<PublicLikeModalProps> = ({
onClose,
onLikeAnonymously,
onJoinAlbumToLike,
+ enableJoin = true,
}) => {
return (
<StyledDialog open={open} onClose={onClose}>
@@ -132,13 +138,15 @@ export const PublicLikeModal: React.FC<PublicLikeModalProps> = ({
>
{t("like_anonymously")}
</AnonymousButton>
- <SignInButton
- variant="contained"
- fullWidth
- onClick={onJoinAlbumToLike}
- >
- {t("join_album_and_like")}
- </SignInButton>
+ {enableJoin && (
+ <SignInButton
+ variant="contained"
+ fullWidth
+ onClick={onJoinAlbumToLike}
+ >
+ {t("join_album_and_like")}
+ </SignInButton>
+ )}
</ButtonsSection>
</ContentContainer>
</DialogWrapper>