Skip to content

Commit 1115301

Browse files
committed
fix(emails): Update oauth_client_info service/name check
Because: * In the verifyLoginCode email, Smart Window and VPN say '... Mozilla?' (the default) in the subject line/body copy, and we want to be consistent with Sync and Relay and focus on '... Firefox?' wording This commit: * Changes the hardcoded check against sync/relay to include the OAuthNativeServices enum to return 'Firefox' as the name closes FXA-13080
1 parent 27d7ad5 commit 1115301

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

packages/fxa-auth-server/lib/senders/oauth_client_info.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
const { Keyv } = require('keyv');
88
const client = require('../oauth/client');
9+
const { OAuthNativeServices } = require('@fxa/accounts/oauth');
10+
11+
const NATIVE_SERVICES = new Set(Object.values(OAuthNativeServices));
912

1013
module.exports = (log, config) => {
1114
const OAUTH_CLIENT_INFO_CACHE_TTL = config.oauth.clientInfoCacheTTL;
@@ -43,7 +46,7 @@ module.exports = (log, config) => {
4346
}
4447

4548
// Set the client name to 'Firefox' if the service is browser-based
46-
if (service === 'sync' || service === 'relay') {
49+
if (NATIVE_SERVICES.has(service)) {
4750
log.trace('fetch.firefoxClient');
4851
return FIREFOX_CLIENT;
4952
}

packages/fxa-auth-server/lib/senders/oauth_client_info.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jest.mock('../oauth/client', () => ({
1212
case '0000000000000000':
1313
throw new Error();
1414
default:
15-
return { name: 'Firefox' };
15+
return { name: 'NotFirefox' };
1616
}
1717
},
1818
}));
@@ -60,6 +60,16 @@ describe('lib/senders/oauth_client_info:', () => {
6060
expect(res.name).toBe('Firefox');
6161
});
6262

63+
it('returns Firefox if service=smartwindow', async () => {
64+
const res = await fetch('smartwindow');
65+
expect(res.name).toBe('Firefox');
66+
});
67+
68+
it('returns Firefox if service=vpn', async () => {
69+
const res = await fetch('vpn');
70+
expect(res.name).toBe('Firefox');
71+
});
72+
6373
it('falls back to Mozilla if error', async () => {
6474
const res = await fetch('0000000000000000');
6575
expect(res.name).toBe('Mozilla');

0 commit comments

Comments
 (0)