Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify disabled album join guest flow

Anand Baburajan34459dc67ab9
diff --git a/web/apps/albums/src/public-album/viewer/components/CommentsSidebar.tsx b/web/apps/albums/src/public-album/viewer/components/CommentsSidebar.tsx
index 1b8b71246b..49e5bd6f36 100644
--- a/web/apps/albums/src/public-album/viewer/components/CommentsSidebar.tsx
+++ b/web/apps/albums/src/public-album/viewer/components/CommentsSidebar.tsx
@@ -747,6 +747,14 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
setLikedComments(newLikedComments);
}, [open, selectedCollectionInfo, reactionsByCollection, currentUserID]);
+ const requestCommentIdentity = () => {
+ if (enableJoin) {
+ setShowPublicCommentModal(true);
+ } else {
+ setShowAddNameModal(true);
+ }
+ };
+
const handleSend = async () => {
if (!commentText.trim() || !file || !selectedCollectionInfo) return;
@@ -754,7 +762,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
if (storedIdentity && publicAlbumsCredentials && collectionKey) {
await sendPublicComment(commentText.trim());
} else {
- setShowPublicCommentModal(true);
+ requestCommentIdentity();
}
};
@@ -935,13 +943,13 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
setReplyingTo(commentToReply);
if (needsIdentityToComment) {
- setShowPublicCommentModal(true);
+ requestCommentIdentity();
}
};
const handleInputClick = () => {
if (needsIdentityToComment) {
- setShowPublicCommentModal(true);
+ requestCommentIdentity();
}
};
@@ -995,7 +1003,12 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
const storedIdentity = getStoredAnonIdentity(collectionID);
if (!storedIdentity) {
setPendingCommentLike(targetComment);
- setShowPublicLikeModal(true);
+ if (enableJoin) {
+ setShowPublicLikeModal(true);
+ } else {
+ setAddNameForCommentLike(true);
+ setShowAddNameModal(true);
+ }
return;
}
diff --git a/web/apps/albums/src/public-album/viewer/components/FileViewer.tsx b/web/apps/albums/src/public-album/viewer/components/FileViewer.tsx
index f757fdf5b9..e2ed2af267 100644
--- a/web/apps/albums/src/public-album/viewer/components/FileViewer.tsx
+++ b/web/apps/albums/src/public-album/viewer/components/FileViewer.tsx
@@ -369,10 +369,18 @@ export const FileViewer: React.FC<FileViewerProps> = ({
const haveUser = false;
+ const requestGuestLikeIdentity = useCallback(() => {
+ if (enableJoin) {
+ setOpenPublicLikeModal(true);
+ } else {
+ setOpenAddNameModal(true);
+ }
+ }, [enableJoin]);
+
const handleLikeClick = useCallback(() => {
const file = activeAnnotatedFileRef.current?.file;
if (!file || !publicAlbumsCredentials) {
- setOpenPublicLikeModal(true);
+ requestGuestLikeIdentity();
return;
}
@@ -461,9 +469,9 @@ export const FileViewer: React.FC<FileViewerProps> = ({
}
})();
} else {
- setOpenPublicLikeModal(true);
+ requestGuestLikeIdentity();
}
- }, [publicAlbumsCredentials, collectionKey]);
+ }, [publicAlbumsCredentials, collectionKey, requestGuestLikeIdentity]);
const handlePublicLikeModalClose = useCallback(
() => setOpenPublicLikeModal(false),