π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show masked emails for registered users in public album likers list
Anand Baburajan581a89f52917
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex 0a36123b68..8cc88e4e51 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -49,6 +49,7 @@ import {deletePublicReaction,getPublicAnonProfiles,getPublicFileReactions,+ getPublicParticipantsMaskedEmails,getStoredAnonIdentity,} from "ente-new/albums/services/public-reaction";import {@@ -2111,6 +2112,23 @@ export const FileViewer: React.FC<FileViewerProps> = ({} catch {// Ignore anon profiles fetch failures}++ // Fetch registered participants' masked emails for public albums+ try {+ const participantEmails =+ await getPublicParticipantsMaskedEmails(+ publicAlbumsCredentials,+ );+ setUserIDToEmail((prev) => {+ const next = new Map(prev);+ for (const [id, email] of participantEmails) {+ next.set(id, email);+ }+ return next;+ });+ } catch {+ // Ignore participants fetch failures+ }} catch (e) {log.error("Failed to fetch public reactions", e);}diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsxindex 0b624465b3..c91d041021 100644--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx@@ -64,6 +64,21 @@ const HeartFilledIcon: React.FC = () => (</svg>);+const PersonIcon: React.FC = () => (+ <svg+ width="16"+ height="16"+ viewBox="0 0 24 24"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ d="M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z"+ fill="currentColor"+ />+ </svg>+);+// =============================================================================// Types// =============================================================================@@ -78,6 +93,8 @@ interface Liker {email: string;/** The first letter of the actual name (not "You") for the avatar. */avatarInitial: string;+ /** True if this is a registered user with masked email (show person icon). */+ isMaskedEmail: boolean;}/** Collection info for the dropdown. */@@ -269,6 +286,10 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({userName = isCurrentUser ? "You" : actualName;}+ // Check if email is masked (starts with *)+ const isMaskedEmail =+ !isAnonymous && actualName.startsWith("*");+return {id: r.id,userID: r.userID,@@ -276,6 +297,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({userName,email,avatarInitial: actualName[0]?.toUpperCase() ?? "?",+ isMaskedEmail,};});}, [@@ -573,7 +595,11 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({color: "#fff",}}>- {liker.avatarInitial}+ {liker.isMaskedEmail ? (+ <PersonIcon />+ ) : (+ liker.avatarInitial+ )}</Avatar><LikerName>{liker.userName}</LikerName><HeartFilledIcon />diff --git a/web/packages/new/albums/services/public-reaction.ts b/web/packages/new/albums/services/public-reaction.tsindex 61db662973..46fa85773e 100644--- a/web/packages/new/albums/services/public-reaction.ts+++ b/web/packages/new/albums/services/public-reaction.ts@@ -378,3 +378,48 @@ const RemoteAnonProfile = z.object({const GetAnonProfilesResponse = z.object({profiles: z.array(RemoteAnonProfile),});++/**+ * A participant with masked email.+ */+export interface Participant {+ userID: number;+ emailMasked: string;+}++/**+ * Get registered participants' masked emails for a public album.+ *+ * This returns masked emails for registered users (album owner/collaborators)+ * who have interacted with the album (comments/reactions).+ *+ * @param credentials Public album credentials (access token).+ * @returns Map of userID to masked email.+ */+export const getPublicParticipantsMaskedEmails = async (+ credentials: PublicAlbumsCredentials,+): Promise<Map<number, string>> => {+ const res = await fetch(+ await apiURL("/public-collection/participants/masked-emails"),+ {+ headers: authenticatedPublicAlbumsRequestHeaders(credentials),+ },+ );+ ensureOk(res);+ const { participants } = GetParticipantsResponse.parse(await res.json());++ const userIDToEmail = new Map<number, string>();+ for (const participant of participants) {+ userIDToEmail.set(participant.userID, participant.emailMasked);+ }+ return userIDToEmail;+};++const RemoteParticipant = z.object({+ userID: z.number(),+ emailMasked: z.string(),+});++const GetParticipantsResponse = z.object({+ participants: z.array(RemoteParticipant),+});