Skip to content

Commit 920bf38

Browse files
committed
Merge branch 'dev' into feature/unified-permissions
2 parents 906dc2b + 9c832e7 commit 920bf38

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/projects/detail/ProjectDetail.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff 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

src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff 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 = {
423425
ProfileSettingsForm.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,

0 commit comments

Comments
 (0)