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 {
217
217
const isCertificatesBlockVisible = isBlockVisible ( courseCertificates . length ) ;
218
218
const isNameBlockVisible = isBlockVisible ( name ) ;
219
219
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
222
222
const isExtendedProfileFieldsVisible = isBlockVisible (
223
223
extendedProfileFields . length > 0 && this . isAuthenticatedUserProfile ( ) ,
224
224
) ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export function* handleFetchProfile(action) {
97
97
98
98
yield put ( fetchProfileReset ( ) ) ;
99
99
} catch ( e ) {
100
- if ( e . response . status === 404 ) {
100
+ if ( e . response ? .status === 404 ) {
101
101
if ( e . processedData && e . processedData . fieldErrors ) {
102
102
yield put ( saveProfileFailure ( e . processedData . fieldErrors ) ) ;
103
103
} else {
Original file line number Diff line number Diff line change @@ -90,10 +90,11 @@ export async function getPreferences(username) {
90
90
const { data } = await getHttpClient ( ) . get ( `${ getConfig ( ) . LMS_BASE_URL } /api/user/v1/preferences/${ username } ` ) ;
91
91
92
92
const processedData = camelCaseObject ( data ) ;
93
+ const visibilityExtendedProfile = Object . prototype . hasOwnProperty . call ( data , 'visibilityExtendedProfile' ) ;
93
94
94
95
return {
95
96
...processedData ,
96
- visibilityExtendedProfile : JSON . parse ( data [ 'visibility.extended_profile' ] ) ,
97
+ visibilityExtendedProfile : visibilityExtendedProfile ? JSON . parse ( data [ 'visibility.extended_profile' ] ) : { } ,
97
98
} ;
98
99
}
99
100
Original file line number Diff line number Diff line change @@ -66,15 +66,9 @@ const ExtendedProfileFields = (props) => {
66
66
className = "mb-5"
67
67
expression = { field . type }
68
68
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 } /> ,
78
72
} }
79
73
/>
80
74
) ;
Original file line number Diff line number Diff line change @@ -113,9 +113,20 @@ const CheckboxField = ({
113
113
</ small >
114
114
</ >
115
115
) ,
116
- static : (
116
+ static : value && (
117
117
< >
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
+ />
119
130
< p data-hj-suppress className = "h5" > { value } </ p >
120
131
</ >
121
132
) ,
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ const SelectField = ({
109
109
</ EmptyContent >
110
110
</ >
111
111
) ,
112
- static : (
112
+ static : value && (
113
113
< >
114
114
< EditableItemHeader
115
115
content = { label }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ const TextField = ({
104
104
</ small >
105
105
</ >
106
106
) ,
107
- static : (
107
+ static : value && (
108
108
< >
109
109
< EditableItemHeader content = { label } />
110
110
< p data-hj-suppress className = "h5" > { value } </ p >
You can’t perform that action at this time.
0 commit comments