π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Skip masked emails API during periodic refresh for public albums
Anand Baburajana92d540f7c8c
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex 66766e2f60..986840ac11 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -2375,6 +2375,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({return next;});+ // Fetch anon profiles (new anonymous users may have commented)try {const anonProfiles = await getPublicAnonProfiles(publicAlbumsCredentials,@@ -2390,22 +2391,8 @@ export const FileViewer: React.FC<FileViewerProps> = ({} catch {// Ignore}-- 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- }+ // Note: Masked emails for registered participants are fetched only+ // on initial load since they rarely change during a session.} catch (e) {log.error("Failed to refresh public social data", e);}diff --git a/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx b/web/packages/gallery/components/viewer/PublicFeedSidebar.tsxindex fb5e5ff5e3..cad9ca1e9f 100644--- a/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx+++ b/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx@@ -720,35 +720,51 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({// Polling interval for refreshing feed data (5 seconds)const FEED_REFRESH_INTERVAL_MS = 5_000;- // Fetch social data (used for both initial load and periodic refresh)- const fetchSocialData = useCallback(async () => {+ // Refresh social data (used for periodic refresh - excludes masked emails)+ const refreshSocialData = useCallback(async () => {try {- const [feedData, anonProfiles, participantEmails] =- await Promise.all([- getPublicAlbumFeed(credentials, collectionKey),- getPublicAnonProfiles(credentials, collectionKey),- getPublicParticipantsMaskedEmails(credentials),- ]);+ const [feedData, anonProfiles] = await Promise.all([+ getPublicAlbumFeed(credentials, collectionKey),+ getPublicAnonProfiles(credentials, collectionKey),+ ]);setComments(feedData.comments);setReactions(feedData.reactions);setAnonUserNames(anonProfiles);- setMaskedEmails(participantEmails);+ // Note: Masked emails for registered participants are fetched only+ // on initial load since they rarely change during a session.} catch (e) {- log.error("Failed to fetch public album feed", e);+ log.error("Failed to refresh public album feed", e);}}, [credentials, collectionKey]);- // Initial fetch when sidebar opens+ // Initial fetch when sidebar opens (includes masked emails)useEffect(() => {if (!open) return;+ const fetchInitialData = async () => {+ try {+ const [feedData, anonProfiles, participantEmails] =+ await Promise.all([+ getPublicAlbumFeed(credentials, collectionKey),+ getPublicAnonProfiles(credentials, collectionKey),+ getPublicParticipantsMaskedEmails(credentials),+ ]);+ setComments(feedData.comments);+ setReactions(feedData.reactions);+ setAnonUserNames(anonProfiles);+ setMaskedEmails(participantEmails);+ } catch (e) {+ log.error("Failed to fetch public album feed", e);+ }+ };+setIsLoading(true);- void fetchSocialData().finally(() => setIsLoading(false));- }, [open, fetchSocialData]);+ void fetchInitialData().finally(() => setIsLoading(false));+ }, [open, credentials, collectionKey]);// Periodic refresh while sidebar is openuseInterval(- fetchSocialData,+ refreshSocialData,open && !isLoading ? FEED_REFRESH_INTERVAL_MS : null,);