Skip to content

armgit / ente

Public Imported from GitHub
0

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

Show You instead of email for current user in likes and comments

Anand Baburajancefbfdd1a393
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index cf8520b75e..40275e37ac 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -240,7 +240,7 @@ const QuotedReply: React.FC<QuotedReplyProps> = ({
// Get the author name - for deleted comments, fall back to email from userIDToEmail
const getAuthorName = (): string => {
if (parentComment.userID === currentUserID) {
- return "Me";
+ return "You";
}
if (!parentComment.isDeleted && parentComment.encData?.userName) {
return parentComment.encData.userName;
@@ -1361,7 +1361,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
>
Replying to{" "}
{replyingTo.userID === currentUserID
- ? "me"
+ ? "yourself"
: replyingTo.encData.userName}
...
</Typography>
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index e3db176b69..1298c90748 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -1864,6 +1864,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
activeCollectionID={activeCollectionID}
fileNormalCollectionIDs={fileNormalCollectionIDs}
collectionSummaries={collectionSummaries}
+ currentUserID={user?.id}
prefetchedReactions={allReactions.get(
activeAnnotatedFile.file.id,
)}
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index 9e82d61b21..e2f31ceedb 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -72,6 +72,8 @@ interface Liker {
id: string;
userID: number;
userName: string;
+ /** The actual email for avatar color, even when userName is "You". */
+ email: string;
}
/** Collection info for the dropdown. */
@@ -103,6 +105,10 @@ export interface LikesSidebarProps extends ModalVisibilityProps {
* Collection summaries indexed by their IDs.
*/
collectionSummaries?: CollectionSummaries;
+ /**
+ * The current user's ID.
+ */
+ currentUserID?: number;
/**
* Pre-fetched reactions by collection ID (includes both file and comment reactions).
*/
@@ -123,6 +129,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
activeCollectionID,
fileNormalCollectionIDs,
collectionSummaries,
+ currentUserID,
prefetchedReactions,
prefetchedUserIDToEmail,
}) => {
@@ -204,16 +211,21 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
reactionsByCollection.get(selectedCollectionInfo.id) ?? [];
return reactions
.filter((r) => r.reactionType === "green_heart")
- .map((r) => ({
- id: r.id,
- userID: r.userID,
- userName:
+ .map((r) => {
+ const email =
prefetchedUserIDToEmail?.get(r.userID) ??
- `User ${r.userID}`,
- }));
+ `User ${r.userID}`;
+ return {
+ id: r.id,
+ userID: r.userID,
+ userName: r.userID === currentUserID ? "You" : email,
+ email,
+ };
+ });
}, [
selectedCollectionInfo,
reactionsByCollection,
+ currentUserID,
prefetchedUserIDToEmail,
]);
@@ -500,11 +512,11 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
width: 32,
height: 32,
fontSize: 14,
- bgcolor: getAvatarColor(liker.userName),
+ bgcolor: getAvatarColor(liker.email),
color: "#fff",
}}
>
- {liker.userName[0]?.toUpperCase() ?? "?"}
+ {liker.email[0]?.toUpperCase() ?? "?"}
</Avatar>
<LikerName>{liker.userName}</LikerName>
<HeartFilledIcon />