From 65bb0424431aac53d3bbc1ea9c1bdc7317a693c6 Mon Sep 17 00:00:00 2001 From: Bianca Severino Date: Wed, 6 Oct 2021 09:36:11 -0400 Subject: [PATCH] fix: display correct messages for name changes Removes confusing wording where alerts and help text would state that the changed name would be used on certificates once approved, even if it wasn't the name that was selected to be used on certificates. --- src/account-settings/AccountSettingsPage.jsx | 48 +++++++++++++++---- .../AccountSettingsPage.messages.jsx | 19 +++++++- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/account-settings/AccountSettingsPage.jsx b/src/account-settings/AccountSettingsPage.jsx index 5bc94ce..71432c5 100644 --- a/src/account-settings/AccountSettingsPage.jsx +++ b/src/account-settings/AccountSettingsPage.jsx @@ -269,7 +269,10 @@ class AccountSettingsPage extends React.Component { switch (status) { case 'submitted': - return this.props.intl.formatMessage(messages['account.settings.field.full.name.help.text.submitted']); + if (this.props.committedValues.useVerifiedNameForCerts) { + return this.props.intl.formatMessage(messages['account.settings.field.full.name.help.text.submitted']); + } + return this.props.intl.formatMessage(messages['account.settings.field.full.name.help.text.submitted.certificate']); default: if (this.props.committedValues.useVerifiedNameForCerts) { return this.props.intl.formatMessage(messages['account.settings.field.full.name.help.text.non.certificate']); @@ -324,7 +327,7 @@ class AccountSettingsPage extends React.Component { ); } - renderVerifiedNameSubmittedMessage = () => ( + renderVerifiedNameSubmittedMessage = (willCertNameChange) => (

- {this.props.intl.formatMessage(messages['account.settings.field.name.verified.submitted.message'])} + {this.props.intl.formatMessage(messages['account.settings.field.name.verified.submitted.message'])}{' '} + { + willCertNameChange + && this.props.intl.formatMessage(messages['account.settings.field.name.verified.submitted.message.certificate']) + }

) renderVerifiedNameMessage = verifiedNameRecord => { - const { created, status, verified_name: verifiedName } = verifiedNameRecord; + const { + created, + status, + profile_name: profileName, + verified_name: verifiedName, + } = verifiedNameRecord; + let willCertNameChange = false; + + if ( + ( + // User submitted a profile name change, and uses their profile name on certificates + this.props.committedValues.name !== profileName + && !this.props.committedValues.useVerifiedNameForCerts + ) + || ( + // User submitted a verified name change, and uses their verified name on certificates + this.props.committedValues.name === profileName + && this.props.committedValues.useVerifiedNameForCerts + ) + ) { + willCertNameChange = true; + } switch (status) { case 'approved': @@ -347,7 +375,7 @@ class AccountSettingsPage extends React.Component { case 'denied': return this.renderVerifiedNameFailureMessage(verifiedName, created); case 'submitted': - return this.renderVerifiedNameSubmittedMessage(); + return this.renderVerifiedNameSubmittedMessage(willCertNameChange); default: return null; } @@ -368,11 +396,14 @@ class AccountSettingsPage extends React.Component { switch (status) { case 'approved': if (this.props.committedValues.useVerifiedNameForCerts) { - return (this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.certificate'])); + return this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.certificate']); } - return (this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.verified'])); + return this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.verified']); case 'submitted': - return (this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.submitted'])); + if (this.props.committedValues.useVerifiedNameForCerts) { + return this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.submitted.certificate']); + } + return this.props.intl.formatMessage(messages['account.settings.field.name.verified.help.text.submitted']); default: return null; } @@ -812,6 +843,7 @@ AccountSettingsPage.propTypes = { verified_name: PropTypes.string, }).isRequired, committedValues: PropTypes.shape({ + name: PropTypes.string, useVerifiedNameForCerts: PropTypes.bool, verified_name: PropTypes.string, }), diff --git a/src/account-settings/AccountSettingsPage.messages.jsx b/src/account-settings/AccountSettingsPage.messages.jsx index bd415b2..2c854f4 100644 --- a/src/account-settings/AccountSettingsPage.messages.jsx +++ b/src/account-settings/AccountSettingsPage.messages.jsx @@ -121,6 +121,11 @@ const messages = defineMessages({ defaultMessage: 'Verification has been submitted. This usually takes 48 hours or less. Verified name cannot be changed at this time.', description: 'Help text for the account settings verified name field when a verified name has been submitted.', }, + 'account.settings.field.name.verified.help.text.submitted.certificate': { + id: 'account.settings.field.name.verified.help.text.submitted.certificate', + defaultMessage: 'When identity verification is successful, this name will appear on your certificates and public-facing records. Verified name cannot be changed at this time.', + description: 'Help text for the account settings verified name field when a verified name has been submitted and will appear on certificates.', + }, 'account.settings.field.name.verified.verification.alert': { id: 'account.settings.field.name.verified.verification.help', defaultMessage: 'Enter your name as it appears on your government-issued ID.', @@ -128,9 +133,14 @@ const messages = defineMessages({ }, 'account.settings.field.full.name.help.text.submitted': { id: 'account.settings.field.full.name.help.text.submitted', - defaultMessage: 'When identity verification is successful, this name will appear on your certificates and public-facing records. Full name cannot be changed at this time.', + defaultMessage: 'Verification has been submitted. This usually takes 48 hours or less. Full name cannot be changed at this time.', description: 'Help text for the account settings full name field when a verified name has been submitted.', }, + 'account.settings.field.full.name.help.text.submitted.certificate': { + id: 'account.settings.field.full.name.help.text.submitted.certificate', + defaultMessage: 'When identity verification is successful, this name will appear on your certificates and public-facing records. Full name cannot be changed at this time.', + description: 'Help text for the account settings full name field when a full name has been submitted and will appear on certificates.', + }, 'account.settings.field.name.verified.success.message': { id: 'account.settings.field.name.verified.success.message', defaultMessage: 'Your identity verification request has successfully completed. You now have the option of selecting which name you prefer to appear on your certificates and public-records.', @@ -158,9 +168,14 @@ const messages = defineMessages({ }, 'account.settings.field.name.verified.submitted.message': { id: 'account.settings.field.name.verified.submitted.message', - defaultMessage: 'Your identity verification request has been submitted and usually takes between 24 and 48 hours to complete. When your request is approved, your updated name will appear on all associated certificates and public-facing records.', + defaultMessage: 'Your identity verification request has been submitted and usually takes between 24 and 48 hours to complete.', description: 'The body of the submitted alert indicating that a user\'s name has been submitted for verification', }, + 'account.settings.field.name.verified.submitted.message.certificate': { + id: 'account.settings.field.name.verified.submitted.message.certificate', + defaultMessage: 'When your request is approved, your updated name will appear on all associated certificates and public-facing records.', + description: 'The body of the submitted alert indicating that a user\'s name will be updated on certificates.', + }, 'account.settings.field.name.verified.submitted.message.header': { id: 'account.settings.field.name.verified.submitted.message.header', defaultMessage: 'Your name change request is almost complete!',