Skip to content

Commit

Permalink
[B] Only show warning if user not established
Browse files Browse the repository at this point in the history
  • Loading branch information
1aurend authored and zdavis committed Feb 23, 2024
1 parent 950c4fa commit b515c2f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions client/src/backend/containers/users/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ export class UsersEditContainer extends PureComponent {

verifyUser = () => {
const t = this.props.t;
const verified = this.user.attributes.admin_verified;
const verified = this.user.attributes.adminVerified;
const heading = verified ? t("modals.unverify") : t("modals.verify");
const message = verified
? t("modals.unverify_body")
: t("modals.verify_body");
this.props.confirm(heading, message, () => {
const adjustedUser = { ...this.user };
adjustedUser.attributes.admin_verified = !verified;
adjustedUser.attributes.adminVerified = !verified;

const call = usersAPI.update(this.user.id, adjustedUser);
const options = { notificationScope: "drawer" };
Expand Down Expand Up @@ -151,6 +151,13 @@ export class UsersEditContainer extends PureComponent {
const user = this.user;
const t = this.props.t;

const establishedWarningProps = !user.attributes.established
? {
instructions: t("records.users.not_established_warning"),
instructionsAreWarning: true
}
: {};

return (
<div>
{this.state.resetPassword ? (
Expand All @@ -166,7 +173,7 @@ export class UsersEditContainer extends PureComponent {
{
onClick: this.verifyUser,
icon: "privacy24",
label: user.attributes.admin_verified
label: user.attributes.adminVerified
? t("records.users.block")
: t("records.users.verify")
},
Expand All @@ -187,9 +194,8 @@ export class UsersEditContainer extends PureComponent {
className: "utility-button__icon--notice"
}
]}
instructions={t("records.users.not_established_warning")}
instructionsAreWarning
buttonLayout="grid"
{...establishedWarningProps}
/>

<section>
Expand Down

0 comments on commit b515c2f

Please sign in to comment.