File tree Expand file tree Collapse file tree 7 files changed +23
-17
lines changed
Expand file tree Collapse file tree 7 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -217,8 +217,8 @@ class ProfilePage extends React.Component {
217217 const isCertificatesBlockVisible = isBlockVisible ( courseCertificates . length ) ;
218218 const isNameBlockVisible = isBlockVisible ( name ) ;
219219 const isLocationBlockVisible = isBlockVisible ( country ) ;
220- // TODO: modify /api/user/v1/accounts/{{username}} to return extended profile fields
221- // So this can be shown for no-authenticated user profiles
220+ // TODO: modify /api/user/v1/accounts/{{username}} to return extended profile field values
221+ // So these fields can be shown for no-authenticated user profiles
222222 const isExtendedProfileFieldsVisible = isBlockVisible (
223223 extendedProfileFields . length > 0 && this . isAuthenticatedUserProfile ( ) ,
224224 ) ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export function* handleFetchProfile(action) {
9797
9898 yield put ( fetchProfileReset ( ) ) ;
9999 } catch ( e ) {
100- if ( e . response . status === 404 ) {
100+ if ( e . response ? .status === 404 ) {
101101 if ( e . processedData && e . processedData . fieldErrors ) {
102102 yield put ( saveProfileFailure ( e . processedData . fieldErrors ) ) ;
103103 } else {
Original file line number Diff line number Diff line change @@ -90,10 +90,11 @@ export async function getPreferences(username) {
9090 const { data } = await getHttpClient ( ) . get ( `${ getConfig ( ) . LMS_BASE_URL } /api/user/v1/preferences/${ username } ` ) ;
9191
9292 const processedData = camelCaseObject ( data ) ;
93+ const visibilityExtendedProfile = Object . prototype . hasOwnProperty . call ( data , 'visibilityExtendedProfile' ) ;
9394
9495 return {
9596 ...processedData ,
96- visibilityExtendedProfile : JSON . parse ( data [ 'visibility.extended_profile' ] ) ,
97+ visibilityExtendedProfile : visibilityExtendedProfile ? JSON . parse ( data [ 'visibility.extended_profile' ] ) : { } ,
9798 } ;
9899}
99100
Original file line number Diff line number Diff line change @@ -66,15 +66,9 @@ const ExtendedProfileFields = (props) => {
6666 className = "mb-5"
6767 expression = { field . type }
6868 cases = { {
69- checkbox : (
70- < CheckboxField { ...commonProps } />
71- ) ,
72- text : (
73- < TextField { ...commonProps } />
74- ) ,
75- select : (
76- < SelectField { ...commonProps } />
77- ) ,
69+ checkbox : < CheckboxField { ...commonProps } /> ,
70+ text : < TextField { ...commonProps } /> ,
71+ select : < SelectField { ...commonProps } /> ,
7872 } }
7973 />
8074 ) ;
Original file line number Diff line number Diff line change @@ -113,9 +113,20 @@ const CheckboxField = ({
113113 </ small >
114114 </ >
115115 ) ,
116- static : (
116+ static : value && (
117117 < >
118- < EditableItemHeader content = { label } />
118+ < EditableItemHeader
119+ content = { (
120+ < Form . Checkbox
121+ id = { formId }
122+ name = { formId }
123+ checked = { value }
124+ >
125+ < div dangerouslySetInnerHTML = { { __html : DOMPurify . sanitize ( label ) } } />
126+ </ Form . Checkbox >
127+ ) }
128+ showVisibility = { false }
129+ />
119130 < p data-hj-suppress className = "h5" > { value } </ p >
120131 </ >
121132 ) ,
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ const SelectField = ({
109109 </ EmptyContent >
110110 </ >
111111 ) ,
112- static : (
112+ static : value && (
113113 < >
114114 < EditableItemHeader
115115 content = { label }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ const TextField = ({
104104 </ small >
105105 </ >
106106 ) ,
107- static : (
107+ static : value && (
108108 < >
109109 < EditableItemHeader content = { label } />
110110 < p data-hj-suppress className = "h5" > { value } </ p >
You can’t perform that action at this time.
0 commit comments