Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use anon user names for avatar colors instead of fixed-length IDs

Anand Baburajan0d25dfdc4042
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index 22929d6843..e96ed71d15 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -1717,14 +1717,15 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
} => {
// If anonymous user, check anonUserNames map
if (comment.anonUserID) {
+ const anonName =
+ anonUserNames?.get(
+ comment.anonUserID,
+ ) ??
+ `Anonymous ${comment.anonUserID.slice(-4)}`;
return {
- name:
- anonUserNames?.get(
- comment.anonUserID,
- ) ??
- `Anonymous ${comment.anonUserID.slice(-4)}`,
- // Use anonUserID for consistent avatar color with LikesSidebar
- avatarColorKey: comment.anonUserID,
+ name: anonName,
+ // Use name for avatar color (varying length like mobile emails)
+ avatarColorKey: anonName,
isMaskedEmail: false,
};
}
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index c91d041021..af602fa364 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -267,7 +267,6 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
let actualName: string;
if (isAnonymous) {
- email = r.anonUserID ?? "anonymous";
// Use decrypted name from anonUserNames if available
const decryptedName = r.anonUserID
? anonUserNames?.get(r.anonUserID)
@@ -275,6 +274,8 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
actualName =
decryptedName ??
`Anonymous ${r.anonUserID?.slice(-4) ?? ""}`;
+ // Use actualName for avatar color (varying length like mobile emails)
+ email = actualName;
userName = isCurrentAnonUser ? "You" : actualName;
} else {
const emailFromMap = prefetchedUserIDToEmail?.get(r.userID);