From 214ef2680253cbcbe9ebd84d94ad93294f47b109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Mon, 28 Jan 2019 14:54:01 +0100 Subject: [PATCH 1/4] make edit user saveable again --- scm-ui/src/users/components/UserForm.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scm-ui/src/users/components/UserForm.js b/scm-ui/src/users/components/UserForm.js index ba1e2f6753..9e04160d3d 100644 --- a/scm-ui/src/users/components/UserForm.js +++ b/scm-ui/src/users/components/UserForm.js @@ -63,14 +63,19 @@ class UserForm extends React.Component { isValid = () => { const user = this.state.user; + + const createUserIsValid = !this.props.user + ? this.state.nameValidationError || + this.isFalsy(user.name) || + !this.state.passwordValid + : false; + return !( - this.state.nameValidationError || + createUserIsValid || this.state.mailValidationError || this.state.displayNameValidationError || - this.isFalsy(user.name) || this.isFalsy(user.displayName) || - this.isFalsy(user.mail) || - !this.state.passwordValid + this.isFalsy(user.mail) ); }; From 028f84e225e141cf03e4bc997eea1f674a1b3e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Mon, 28 Jan 2019 15:02:08 +0100 Subject: [PATCH 2/4] only enable submit button user changed something at editing --- scm-ui/src/users/components/UserForm.js | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/scm-ui/src/users/components/UserForm.js b/scm-ui/src/users/components/UserForm.js index 9e04160d3d..a241b583c3 100644 --- a/scm-ui/src/users/components/UserForm.js +++ b/scm-ui/src/users/components/UserForm.js @@ -61,17 +61,38 @@ class UserForm extends React.Component { return false; } - isValid = () => { + createUserComponentsAreValid = () => { const user = this.state.user; - - const createUserIsValid = !this.props.user - ? this.state.nameValidationError || + if (!this.props.user) { + return ( + this.state.nameValidationError || this.isFalsy(user.name) || !this.state.passwordValid - : false; + ); + } else { + return false; + } + }; + editUserComponentsAreChanged = () => { + const user = this.state.user; + if (this.props.user) { + return ( + this.props.user.displayName === user.displayName && + this.props.user.mail === user.mail && + this.props.user.admin === user.admin && + this.props.user.active === user.active + ); + } else { + return false; + } + }; + + isValid = () => { + const user = this.state.user; return !( - createUserIsValid || + this.createUserComponentsAreValid() || + this.editUserComponentsAreChanged() || this.state.mailValidationError || this.state.displayNameValidationError || this.isFalsy(user.displayName) || From 8dc2204b3f3eb4ff025d8806231c9f96120bb7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 31 Jan 2019 10:37:48 +0100 Subject: [PATCH 3/4] renaming --- scm-ui/src/users/components/UserForm.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scm-ui/src/users/components/UserForm.js b/scm-ui/src/users/components/UserForm.js index a241b583c3..9bf36d19d0 100644 --- a/scm-ui/src/users/components/UserForm.js +++ b/scm-ui/src/users/components/UserForm.js @@ -61,7 +61,7 @@ class UserForm extends React.Component { return false; } - createUserComponentsAreValid = () => { + createUserComponentsAreInvalid = () => { const user = this.state.user; if (!this.props.user) { return ( @@ -74,7 +74,7 @@ class UserForm extends React.Component { } }; - editUserComponentsAreChanged = () => { + editUserComponentsAreUnchanged = () => { const user = this.state.user; if (this.props.user) { return ( @@ -91,8 +91,8 @@ class UserForm extends React.Component { isValid = () => { const user = this.state.user; return !( - this.createUserComponentsAreValid() || - this.editUserComponentsAreChanged() || + this.createUserComponentsAreInvalid() || + this.editUserComponentsAreUnchanged() || this.state.mailValidationError || this.state.displayNameValidationError || this.isFalsy(user.displayName) || From e7a96cfe8f55866b6bdfbd3a6bbe0f2c6814ce1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 31 Jan 2019 09:41:55 +0000 Subject: [PATCH 4/4] Close branch bugfix/user_editing