Skip to content

Conversation

@yoution
Copy link
Collaborator

@yoution yoution commented Mar 1, 2021

No description provided.

Copy link
Collaborator

@maxceem maxceem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoution it works good, but there are some small improvements I'd like to make.

  1. We have to wait until the user credentials are loaded, to make sure that when we show the form we already know is user uses SSO login or no. See how we check if we still loading setting or no https://github.com/appirio-tech/connect-app/blob/dev/src/routes/settings/routes/system/containers/SystemSettingsContainer.jsx#L15.

  2. There are some small code improvements to make. Please, kindly check comments below.

</div>: null}

<div className="form">
{!usingSsoService ? <div className="form">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be simplified as {!usingSsoService && <div className="form">. No need for ternary operator .. ? .. : null.

</div>

<div styleName="section-heading">
{!usingSsoService ?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be simplified as {!usingSsoService &&. No need for ternary operator .. ? .. : null.

disabled={usingSsoService? true: systemSettings.disabled === true}
/>

{usingSsoService ? <div styleName="error-message">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be simplified as {usingSsoService && <div styleName="error-message">. No need for ternary operator .. ? .. : null.

checkEmailAvailability={checkEmailAvailability}
onSubmit={(email) => changeEmail(email)}
{...systemSettings}
disabled={usingSsoService? true: systemSettings.disabled === true}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep things clear, I suggest passing usingSsoService to the ChangeEmailForm component and use it inside. Because we have various reasons when we disable form. Also, this condition is a bit hard to ready.

isEmail: 'Provide a correct email'
}}
disabled={isEmailChanging || !hasPermission(PERMISSIONS.UPDATE_USER_EMAIL)}
disabled={disabled ||isEmailChanging || !hasPermission(PERMISSIONS.UPDATE_USER_EMAIL)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I suggest in another comment, let's not pass disabled here, but pass usingSsoService directly here, so we can understand more clearly why we disable this field.

@yoution yoution requested a review from maxceem March 3, 2021 14:33
Copy link
Collaborator

@maxceem maxceem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoution all is perfect now.

@maxceem maxceem merged commit 3c5adbb into topcoder-archive:dev Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants