File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
routes/settings/routes/profile/components Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,12 @@ class ProjectDetail extends Component {
190190 }
191191 }
192192
193- // as soon as user profile settings are loaded, check if all required fields are completed or show the popup
194- if ( this . props . profileSettings . isLoading && ! profileSettings . isLoading && ! isUserProfileComplete ( nextProps . currentUser , profileSettings . settings ) ) {
193+ // as soon as user profile settings and project are both loaded, check if all required fields are completed or show the popup
194+ const profileSettingsJustLoaded = this . props . profileSettings . isLoading && ! profileSettings . isLoading
195+ const projectJustLoaded = this . props . isLoading && ! isLoading
196+ const timeToShowIncompleteProfile = ! profileSettings . isLoading && ! isLoading && ( profileSettingsJustLoaded || projectJustLoaded )
197+ const projectLoadingError = nextProps . error && ( nextProps . error . type === LOAD_PROJECT_FAILURE || nextProps . error . type === ACCEPT_OR_REFUSE_INVITE_FAILURE )
198+ if ( ! projectLoadingError && timeToShowIncompleteProfile && ! isUserProfileComplete ( nextProps . currentUser , profileSettings . settings ) ) {
195199 this . setState ( { showIncompleteProfilePopup : true } )
196200 }
197201
Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ class ProfileSettingsForm extends Component {
4747 }
4848
4949 componentDidUpdate ( ) {
50+ // if we want to show validation errors on form showing
5051 if ( this . refs . form && ! this . isValidated && this . props . shouldDoValidateOnStart ) {
51- this . refs . form . submit ( )
52+ // we have to mark the form as not pristine, so validation errors are shown
53+ this . refs . form . setFormPristine ( false )
5254 this . isValidated = true
5355 }
5456 }
@@ -423,7 +425,7 @@ ProfileSettingsForm.defaultProps = {
423425ProfileSettingsForm . propTypes = {
424426 values : PropTypes . object . isRequired ,
425427 saveSettings : PropTypes . func . isRequired ,
426- uploadPhoto : PropTypes . func . isRequired ,
428+ uploadPhoto : PropTypes . func ,
427429 fieldsConfig : PropTypes . shape ( {
428430 avatar : PropTypes . bool ,
429431 firstName : PropTypes . bool ,
You can’t perform that action at this time.
0 commit comments