@@ -246,9 +246,16 @@ export const visibilitiesSelector = createSelector(
246246 visibilityLanguageProficiencies : preferences . visibilityLanguageProficiencies || 'all_users' ,
247247 visibilityName : preferences . visibilityName || 'all_users' ,
248248 visibilitySocialLinks : preferences . visibilitySocialLinks || 'all_users' ,
249- visibilityExtendedProfile : preferences . visibilityExtendedProfile || 'all_users' ,
249+ visibilityExtendedProfile : preferences . visibilityExtendedProfile || { } ,
250250 } ;
251- case 'private' :
251+ case 'private' : {
252+ const visibilityExtendedProfile = { } ;
253+
254+ if ( preferences . visibilityExtendedProfile ) {
255+ Object . keys ( preferences . visibilityExtendedProfile ) . forEach ( ( key ) => {
256+ visibilityExtendedProfile [ key ] = 'private' ;
257+ } ) ;
258+ }
252259 return {
253260 visibilityBio : 'private' ,
254261 visibilityCourseCertificates : 'private' ,
@@ -257,14 +264,22 @@ export const visibilitiesSelector = createSelector(
257264 visibilityLanguageProficiencies : 'private' ,
258265 visibilityName : 'private' ,
259266 visibilitySocialLinks : 'private' ,
260- visibilityExtendedProfile : 'private' ,
267+ visibilityExtendedProfile,
261268 } ;
269+ }
262270 case 'all_users' :
263- default :
271+ default : {
264272 // All users is intended to fall through to default.
265273 // If there is no value for accountPrivacy in perferences, that means it has not been
266274 // explicitly set yet. The server assumes - today - that this means "all_users",
267275 // so we emulate that here in the client.
276+ const visibilityExtendedProfile = { } ;
277+ if ( preferences . visibilityExtendedProfile ) {
278+ Object . keys ( preferences . visibilityExtendedProfile ) . forEach ( ( key ) => {
279+ visibilityExtendedProfile [ key ] = 'all_users' ;
280+ } ) ;
281+ }
282+
268283 return {
269284 visibilityBio : 'all_users' ,
270285 visibilityCourseCertificates : 'all_users' ,
@@ -273,8 +288,8 @@ export const visibilitiesSelector = createSelector(
273288 visibilityLanguageProficiencies : 'all_users' ,
274289 visibilityName : 'all_users' ,
275290 visibilitySocialLinks : 'all_users' ,
276- visibilityExtendedProfile : 'all_users' ,
277- } ;
291+ visibilityExtendedProfile,
292+ } ; }
278293 }
279294 } ,
280295) ;
@@ -393,6 +408,7 @@ export const profilePageSelector = createSelector(
393408 photoUploadError : errors . photo || null ,
394409
395410 // Extended profile fields
411+ // Combine the field properties and its values
396412 extendedProfileFields : extendedProfileFields . map ( ( field ) => ( {
397413 ...field ,
398414 value : account . extendedProfile ?. find (
0 commit comments