Skip to content

Commit

Permalink
send success email message from account component
Browse files Browse the repository at this point in the history
  • Loading branch information
Addison-Stavlo committed Sep 19, 2024
1 parent 4b96445 commit d763759
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions client/me/account/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,6 @@ class Account extends Component {
}

async handleSubmitSuccess( response, formName = '' ) {
const isEmailUpdate = this.hasUnsavedUserSetting( 'user_email' );

if ( ! this.hasUnsavedUserSettings( ACCOUNT_FIELDS.concat( INTERFACE_FIELDS ) ) ) {
this.props.markSaved();
}
Expand All @@ -614,6 +612,8 @@ class Account extends Component {
return;
}

const newEmail = this.getUserSetting( 'new_user_email' );

this.setState(
{
submittingForm: false,
Expand All @@ -627,14 +627,16 @@ class Account extends Component {
this.props.translate( 'Settings saved successfully!' ),
noticeOptions
);
isEmailUpdate &&
this.props.translate(
'We sent an email to %(email)s. Please check your inbox to verify your email.',
{
args: {
email: this.props.userSettings?.new_user_email || '',
},
}
newEmail &&
this.props.successNotice(
this.props.translate(
'We sent an email to %(email)s. Please check your inbox to verify your email.',
{
args: {
email: newEmail || '',
},
}
)
);
}
);
Expand Down

0 comments on commit d763759

Please sign in to comment.