Merge pull request #525 from edx/bseverino/name-change-pending-message

[MST-1106] Display correct messages for name changes
This commit is contained in:
Bianca Severino
2021-10-06 11:24:37 -04:00
committed by GitHub
2 changed files with 57 additions and 10 deletions

View File

@@ -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) => (
<Alert
variant="warning"
icon={WarningFilled}
@@ -333,13 +336,38 @@ class AccountSettingsPage extends React.Component {
{this.props.intl.formatMessage(messages['account.settings.field.name.verified.submitted.message.header'])}
</Alert.Heading>
<p>
{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'])
}
</p>
</Alert>
)
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,
}),

View File

@@ -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!',