Skip to content

Commit 6a54b7c

Browse files
authored
fix(client): change twitter to X and update twitter URL's (freeCodeCamp#64046)
1 parent a09b430 commit 6a54b7c

File tree

11 files changed

+18
-22
lines changed

11 files changed

+18
-22
lines changed

api/src/routes/protected/user.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ const publicUserData = {
307307
portfolio: testUserData.portfolio,
308308
profileUI: testUserData.profileUI,
309309
savedChallenges: testUserData.savedChallenges,
310-
twitter: 'https://twitter.com/foobar',
310+
twitter: 'https://x.com/foobar',
311311
bluesky: 'https://bsky.app/profile/foobar',
312312
sendQuincyEmail: testUserData.sendQuincyEmail,
313313
username: testUserData.username,

api/src/routes/public/user.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const publicUserData = {
218218
points: 2,
219219
portfolio: testUserData.portfolio,
220220
profileUI: testUserData.profileUI,
221-
twitter: 'https://twitter.com/foobar',
221+
twitter: 'https://x.com/foobar',
222222
bluesky: 'https://bsky.app/profile/foobar',
223223
username: testUserData.username,
224224
usernameDisplay: testUserData.usernameDisplay,

api/src/utils/normalize.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ import {
1212
describe('normalize', () => {
1313
describe('normalizeTwitter', () => {
1414
test('returns the input if it is a url', () => {
15-
const url = 'https://twitter.com/a_generic_user';
15+
const url = 'https://x.com/a_generic_user';
1616
expect(normalizeTwitter(url)).toEqual(url);
1717
});
18-
test('adds the handle to twitter.com if it is not a url', () => {
18+
test('adds the handle to x.com if it is not a url', () => {
1919
const handle = '@a_generic_user';
20-
expect(normalizeTwitter(handle)).toEqual(
21-
'https://twitter.com/a_generic_user'
22-
);
20+
expect(normalizeTwitter(handle)).toEqual('https://x.com/a_generic_user');
2321
});
2422
test('returns undefined if that is the input', () => {
2523
expect(normalizeTwitter('')).toBeUndefined();

api/src/utils/normalize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const normalizeTwitter = (
3535
try {
3636
new URL(handleOrUrl);
3737
} catch {
38-
url = `https://twitter.com/${handleOrUrl.replace(/^@/, '')}`;
38+
url = `https://x.com/${handleOrUrl.replace(/^@/, '')}`;
3939
}
4040
return url ?? handleOrUrl;
4141
};

client/i18n/locales/english/translations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@
930930
"linkedin": "Link to {{username}}'s LinkedIn",
931931
"github": "Link to {{username}}'s GitHub",
932932
"website": "Link to {{username}}'s website",
933-
"twitter": "Link to {{username}}'s Twitter",
933+
"twitter": "Link to {{username}}'s X",
934934
"next-month": "Go to next month",
935935
"previous-month": "Go to previous month",
936936
"first-page": "Go to first page",

client/src/client-only-routes/show-certification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ const ShareCertBtns = ({
240240
block={true}
241241
size='large'
242242
variant='primary'
243-
href={`https://twitter.com/intent/tweet?text=${t('profile.tweet', {
243+
href={`https://x.com/intent/post?text=${t('profile.tweet', {
244244
certTitle: urlFriendlyCertTitle,
245245
certURL
246246
})}`}

client/src/components/profile/components/internet.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,10 @@ const InternetSettings = ({
204204
controlId='internet-twitter'
205205
validationState={twitterValidation}
206206
>
207-
<ControlLabel htmlFor='internet-twitter-input'>
208-
Twitter
209-
</ControlLabel>
207+
<ControlLabel htmlFor='internet-twitter-input'>X</ControlLabel>
210208
<FormControl
211209
onChange={createHandleChange('twitter')}
212-
placeholder='https://twitter.com/user-name'
210+
placeholder='https://x.com/user-name'
213211
type='url'
214212
value={formValues.twitter}
215213
id='internet-twitter-input'

client/src/components/share/share-template.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const ShareTemplate: React.ComponentType<ShareRedirectProps> = ({
2626
<FontAwesomeIcon
2727
icon={faXTwitter}
2828
size='1x'
29-
aria-label='twitterIcon'
29+
aria-label='xIcon'
3030
aria-hidden='true'
3131
/>
3232
{t('buttons.share-on-x')}

client/src/components/share/use-share.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export const nextLine = '%0A';
77
const freecodecampLearnDomainURL = 'www.freecodecamp.org/learn';
88

99
export const twitterData = {
10-
action: 'intent/tweet',
11-
domain: 'twitter.com',
12-
developerDomainURL: 'https://developer.twitter.com'
10+
action: 'intent/post',
11+
domain: 'x.com',
12+
developerDomainURL: 'https://developer.x.com'
1313
};
1414

1515
export const blueSkyData = {

e2e/certification.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test.describe('Certification page - Non Microsoft', () => {
9999
await expect(twitterLink).toBeVisible();
100100
await expect(twitterLink).toHaveAttribute(
101101
'href',
102-
`https://twitter.com/intent/tweet?text=I just earned the Legacy%20Responsive%20Web%20Design%20V8 certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/certifieduser/responsive-web-design`
102+
`https://x.com/intent/post?text=I just earned the Legacy%20Responsive%20Web%20Design%20V8 certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/certifieduser/responsive-web-design`
103103
);
104104

105105
const projectLinks = certLink.getByTestId('project-links');
@@ -259,7 +259,7 @@ test.describe('Certification page - Microsoft', () => {
259259
await expect(twitterLink).toBeVisible();
260260
await expect(twitterLink).toHaveAttribute(
261261
'href',
262-
'https://twitter.com/intent/tweet?text=I just earned the Foundational%20C%23%20with%20Microsoft certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/certifieduser/foundational-c-sharp-with-microsoft'
262+
'https://x.com/intent/post?text=I just earned the Foundational%20C%23%20with%20Microsoft certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/certifieduser/foundational-c-sharp-with-microsoft'
263263
);
264264

265265
const projectLinks = certLink.getByTestId('project-links');

0 commit comments

Comments
 (0)