WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit d7917de

Browse files
authored
Merge pull request #18454 from mozilla/FXA-11177
fix(settings): Bug fixes for the recovery phone sub row
2 parents 6cf0193 + 8b6de05 commit d7917de

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

packages/functional-tests/pages/settings/components/unitRow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class TotpRow extends UnitRow {
9494
}
9595

9696
get changeButton() {
97-
return this.page.getByRole('button', { name: 'Get new codes' });
97+
return this.page.getByRole('button', { name: 'Create new codes' });
9898
}
9999

100100
get addRecoveryPhoneButton() {

packages/fxa-settings/src/components/Settings/SubRow/en.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tfa-row-backup-codes-available-v2 = { $numCodesAvailable ->
1111
*[other] { $numCodesAvailable } codes remaining
1212
}
1313
# Shown to users who have backup authentication codes - this will allow them to generate new codes to replace the previous ones
14-
tfa-row-backup-codes-get-new-cta = Get new codes
14+
tfa-row-backup-codes-get-new-cta-v2 = Create new codes
1515
# Shown to users who have no backup authentication codes
1616
# Button to add backup authentication codes when none are configured
1717
tfa-row-backup-codes-add-cta = Add
@@ -22,7 +22,7 @@ tfa-row-backup-codes-description-2 = This is the safest recovery method if you c
2222
# A recovery code can be sent to the user's phone
2323
tfa-row-backup-phone-title-v2 = Recovery phone
2424
# Shown with an alert icon to indicate that no recovery phone is configured
25-
tfa-row-backup-phone-not-available = No recovery phone number available
25+
tfa-row-backup-phone-not-available-v2 = No phone number added
2626
# button to change the configured recovery phone
2727
tfa-row-backup-phone-change-cta = Change
2828
# button to add/configure a recovery phone

packages/fxa-settings/src/components/Settings/SubRow/index.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const GenericSubRowWithDescription: StoryFn = () => (
5959
export const BackupCodesAvailable: StoryFn = () => (
6060
<BackupCodesSubRow
6161
numCodesAvailable={5}
62-
onCtaClick={action('Get new codes clicked')}
62+
onCtaClick={action('Create new codes clicked')}
6363
/>
6464
);
6565

packages/fxa-settings/src/components/Settings/SubRow/index.test.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
describe('SubRow', () => {
1515
const defaultProps = {
1616
ctaGleanId: 'glean-test',
17-
ctaMessage: 'Get new codes',
17+
ctaMessage: 'Create new codes',
1818
icon: <div>Icon</div>,
1919
idPrefix: 'test',
2020
localizedDescription: 'More info message',
@@ -27,21 +27,21 @@ describe('SubRow', () => {
2727
renderWithLocalizationProvider(<SubRow {...defaultProps} isEnabled />);
2828
expect(screen.getByText('Backup authentication codes')).toBeInTheDocument();
2929
expect(screen.getByText('Message')).toBeInTheDocument();
30-
expect(screen.getByText('Get new codes')).toBeInTheDocument();
30+
expect(screen.getByText('Create new codes')).toBeInTheDocument();
3131
expect(screen.getByText('More info message')).toBeInTheDocument();
3232
});
3333

3434
it('renders correctly when unavailable', () => {
3535
render(<SubRow {...defaultProps} isEnabled={false} />);
3636
expect(screen.getByText('Backup authentication codes')).toBeInTheDocument();
3737
expect(screen.getByText('Message')).toBeInTheDocument();
38-
const cta = screen.getByRole('button', { name: 'Get new codes' });
38+
const cta = screen.getByRole('button', { name: 'Create new codes' });
3939
expect(cta).toBeInTheDocument();
4040
});
4141

4242
it('calls onCtaClick when CTA button is clicked', () => {
4343
renderWithLocalizationProvider(<SubRow {...defaultProps} isEnabled />);
44-
fireEvent.click(screen.getByText('Get new codes'));
44+
fireEvent.click(screen.getByText('Create new codes'));
4545
expect(defaultProps.onCtaClick).toHaveBeenCalled();
4646
});
4747
});
@@ -59,7 +59,7 @@ describe('BackupCodesSubRow', () => {
5959
screen.getByText('Backup authentication codes')
6060
).toBeInTheDocument();
6161
expect(screen.getByText('5 codes remaining')).toBeInTheDocument();
62-
expect(screen.getByText('Get new codes')).toBeInTheDocument();
62+
expect(screen.getByText('Create new codes')).toBeInTheDocument();
6363
});
6464

6565
it('renders correctly when 1 code is available', () => {
@@ -78,7 +78,7 @@ describe('BackupCodesSubRow', () => {
7878
screen.getByText('Backup authentication codes')
7979
).toBeInTheDocument();
8080
expect(screen.getByText('5 codes remaining')).toBeInTheDocument();
81-
expect(screen.getByText('Get new codes')).toBeInTheDocument();
81+
expect(screen.getByText('Create new codes')).toBeInTheDocument();
8282
expect(
8383
screen.getByText(
8484
'This is the safest recovery method if you canʼt use your mobile device or authenticator app.'
@@ -88,7 +88,7 @@ describe('BackupCodesSubRow', () => {
8888

8989
it('calls onCtaClick when CTA button is clicked', () => {
9090
renderWithLocalizationProvider(<BackupCodesSubRow {...defaultProps} />);
91-
fireEvent.click(screen.getByText('Get new codes'));
91+
fireEvent.click(screen.getByText('Create new codes'));
9292
expect(defaultProps.onCtaClick).toHaveBeenCalled();
9393
});
9494
});
@@ -126,9 +126,7 @@ describe('BackupPhoneSubRow', () => {
126126
<BackupPhoneSubRow onCtaClick={jest.fn()} />
127127
);
128128
expect(screen.getByText('Recovery phone')).toBeInTheDocument();
129-
expect(
130-
screen.getByText('No recovery phone number available')
131-
).toBeInTheDocument();
129+
expect(screen.getByText('No phone number added')).toBeInTheDocument();
132130
expect(screen.getByRole('button', { name: 'Add' })).toBeInTheDocument();
133131
expect(
134132
screen.getByText(

packages/fxa-settings/src/components/Settings/SubRow/index.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ export const BackupCodesSubRow = ({
195195
</FtlMsg>
196196
);
197197
const ctaMessage = hasCodesRemaining
198-
? ftlMsgResolver.getMsg('tfa-row-backup-codes-get-new-cta', 'Get new codes')
198+
? ftlMsgResolver.getMsg(
199+
'tfa-row-backup-codes-get-new-cta-v2',
200+
'Create new codes'
201+
)
199202
: ftlMsgResolver.getMsg('tfa-row-backup-codes-add-cta', 'Add');
200203

201204
const ctaGleanId = hasCodesRemaining
@@ -241,8 +244,8 @@ export const BackupPhoneSubRow = ({
241244
// Phone numbers should always be displayed left-to-right, *including* in rtl languages
242245
<p dir="ltr">{phoneNumber}</p>
243246
) : (
244-
<FtlMsg id="tfa-row-backup-phone-not-available">
245-
<p>No recovery phone number available</p>
247+
<FtlMsg id="tfa-row-backup-phone-not-available-v2">
248+
<p>No phone number added</p>
246249
</FtlMsg>
247250
);
248251
const ctaMessage = hasPhoneNumber
@@ -290,15 +293,10 @@ export const BackupPhoneSubRow = ({
290293
),
291294
}
292295
: null)}
293-
{...((!hasPhoneNumber || (hasPhoneNumber && onDeleteClick)) && {
294-
// description should not be shown when the user can't delete the phone number (only one message displayed at a time)
295-
// description should only be shown when both backup authentication codes and recovery phone
296-
// are available recovery methods (description is intended to allow for comparison of the two methods)
297-
localizedDescription: ftlMsgResolver.getMsg(
298-
'tfa-row-backup-phone-description',
299-
'This is the easier recovery method if you canʼt use your authenticator app.'
300-
),
301-
})}
296+
localizedDescription={ftlMsgResolver.getMsg(
297+
'tfa-row-backup-phone-description',
298+
'This is the easier recovery method if you canʼt use your authenticator app.'
299+
)}
302300
{...{
303301
ctaGleanId,
304302
ctaMessage,

0 commit comments

Comments
 (0)