Skip to content

Commit

Permalink
Merge pull request #62 from edx/ahtesham/confirmation-strings-removal…
Browse files Browse the repository at this point in the history
…-branch

fix: remove account activation strings
  • Loading branch information
ahtesham-quraish authored Jun 10, 2024
2 parents bf2748c + 786d33e commit c18a2d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 101 deletions.
11 changes: 5 additions & 6 deletions src/forms/login-popup/components/AccountActivationMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const AccountActivationMessage = ({ messageType = null }) => {
}

const variant = messageType === ACCOUNT_ACTIVATION_MESSAGE.ERROR ? 'danger' : messageType;
const activationOrConfirmation = 'Confirmation';
const iconMapping = {
[ACCOUNT_ACTIVATION_MESSAGE.SUCCESS]: CheckCircle,
[ACCOUNT_ACTIVATION_MESSAGE.ERROR]: Error,
Expand All @@ -34,22 +33,22 @@ const AccountActivationMessage = ({ messageType = null }) => {
let heading;
switch (messageType) {
case ACCOUNT_ACTIVATION_MESSAGE.SUCCESS: {
heading = formatMessage(messages[`account${activationOrConfirmation}SuccessMessageTitle`]);
activationMessage = <span>{formatMessage(messages[`account${activationOrConfirmation}SuccessMessage`])}</span>;
heading = formatMessage(messages.accountConfirmationSuccessMessageTitle);
activationMessage = <span>{formatMessage(messages.accountConfirmationSuccessMessage)}</span>;
break;
}
case ACCOUNT_ACTIVATION_MESSAGE.INFO: {
activationMessage = formatMessage(messages[`account${activationOrConfirmation}InfoMessage`]);
activationMessage = formatMessage(messages.accountConfirmationInfoMessage);
break;
}
case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {
const supportLink = (
<Alert.Link href={getConfig().ACTIVATION_EMAIL_SUPPORT_LINK}>
{formatMessage(messages.accountActivationSupportLink)}
{formatMessage(messages.accountConfirmationSupportLink)}
</Alert.Link>
);

heading = formatMessage(messages[`account${activationOrConfirmation}ErrorMessageTitle`]);
heading = formatMessage(messages.accountConfirmationErrorMessageTitle);
activationMessage = (
<FormattedMessage
id="account.activation.error.message"
Expand Down
69 changes: 0 additions & 69 deletions src/forms/login-popup/components/AccountActivationMessage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,6 @@ import { ACCOUNT_ACTIVATION_MESSAGE } from '../data/constants';

const IntlAccountActivationMessage = injectIntl(AccountActivationMessage);

describe('AccountActivationMessage', () => {
beforeEach(() => {
mergeConfig({
MARKETING_EMAILS_OPT_IN: '',
});
});

afterEach(() => {
jest.clearAllMocks();
});

it('should match account already activated message', () => {
render(
<IntlProvider locale="en">
<IntlAccountActivationMessage messageType={ACCOUNT_ACTIVATION_MESSAGE.INFO} />
</IntlProvider>,
);

const expectedMessage = 'This email has already been confirmed.';

expect(screen.getByText(
'',
{ selector: '#account-activation-message' },
).textContent).toBe(expectedMessage);
});

it('should match account activated success message', () => {
render(
<IntlProvider locale="en">
<IntlAccountActivationMessage messageType={ACCOUNT_ACTIVATION_MESSAGE.SUCCESS} />
</IntlProvider>,
);

const expectedMessage = 'Success! You have confirmed your email.Sign in to continue.';

expect(screen.getByText(
'',
{ selector: '#account-activation-message' },
).textContent).toBe(expectedMessage);
});

it('should match account activation error message', () => {
render(
<IntlProvider locale="en">
<IntlAccountActivationMessage messageType={ACCOUNT_ACTIVATION_MESSAGE.ERROR} />
</IntlProvider>,
);

const expectedMessage = 'Your email could not be confirmed'
+ 'Something went wrong, please contact support to resolve this issue.';

expect(screen.getByText(
'',
{ selector: '#account-activation-message' },
).textContent).toBe(expectedMessage);
});

it('should not display anything for invalid message type', () => {
const { container } = render(
<IntlProvider locale="en">
<IntlAccountActivationMessage messageType="invalid-message" />
</IntlProvider>,
);

const accountActivationMessage = container.querySelectorAll('#account-activation-message');
expect(accountActivationMessage[0]).toBe(undefined);
});
});

describe('EmailConfirmationMessage', () => {
beforeEach(() => {
mergeConfig({
Expand Down
31 changes: 5 additions & 26 deletions src/forms/login-popup/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,32 +159,6 @@ const messages = defineMessages({
+ 'Thank you for helping us keep your data safe.',
description: 'Error message for non-compliant password',
},
// Account Activation Strings
accountActivationSuccessMessageTitle: {
id: 'account.activation.success.message.title',
defaultMessage: 'Success! You have activated your account.',
description: 'Account Activation success message title',
},
accountActivationSuccessMessage: {
id: 'account.activation.success.message',
defaultMessage: 'You will now receive email updates and alerts from us related to the courses you are enrolled in. Sign in to continue.',
description: 'Message show to learners when their account has been activated successfully',
},
accountActivationInfoMessage: {
id: 'account.activation.info.message',
defaultMessage: 'This account has already been activated.',
description: 'Message shown when learner account has already been activated',
},
accountActivationErrorMessageTitle: {
id: 'account.activation.error.message.title',
defaultMessage: 'Your account could not be activated',
description: 'Account Activation error message title',
},
accountActivationSupportLink: {
id: 'account.activation.support.link',
defaultMessage: 'contact support',
description: 'Link text used in account activation error message to go to learner help center',
},
// Email Confirmation Strings
accountConfirmationSuccessMessageTitle: {
id: 'account.confirmation.success.message.title',
Expand All @@ -206,6 +180,11 @@ const messages = defineMessages({
defaultMessage: 'Your email could not be confirmed',
description: 'Account verification error message title',
},
accountConfirmationSupportLink: {
id: 'account.confirmation.support.link',
defaultMessage: 'contact support',
description: 'Link text used in account confirmation error message to go to learner help center',
},
});

export default messages;

0 comments on commit c18a2d7

Please sign in to comment.