fix(client): change twitter to X and update twitter URL's (#64046)

This commit is contained in:
Tom
2025-12-08 04:49:23 -06:00
committed by GitHub
parent a09b4301de
commit 6a54b7c43f
11 changed files with 18 additions and 22 deletions

View File

@@ -307,7 +307,7 @@ const publicUserData = {
portfolio: testUserData.portfolio, portfolio: testUserData.portfolio,
profileUI: testUserData.profileUI, profileUI: testUserData.profileUI,
savedChallenges: testUserData.savedChallenges, savedChallenges: testUserData.savedChallenges,
twitter: 'https://twitter.com/foobar', twitter: 'https://x.com/foobar',
bluesky: 'https://bsky.app/profile/foobar', bluesky: 'https://bsky.app/profile/foobar',
sendQuincyEmail: testUserData.sendQuincyEmail, sendQuincyEmail: testUserData.sendQuincyEmail,
username: testUserData.username, username: testUserData.username,

View File

@@ -218,7 +218,7 @@ const publicUserData = {
points: 2, points: 2,
portfolio: testUserData.portfolio, portfolio: testUserData.portfolio,
profileUI: testUserData.profileUI, profileUI: testUserData.profileUI,
twitter: 'https://twitter.com/foobar', twitter: 'https://x.com/foobar',
bluesky: 'https://bsky.app/profile/foobar', bluesky: 'https://bsky.app/profile/foobar',
username: testUserData.username, username: testUserData.username,
usernameDisplay: testUserData.usernameDisplay, usernameDisplay: testUserData.usernameDisplay,

View File

@@ -12,14 +12,12 @@ import {
describe('normalize', () => { describe('normalize', () => {
describe('normalizeTwitter', () => { describe('normalizeTwitter', () => {
test('returns the input if it is a url', () => { test('returns the input if it is a url', () => {
const url = 'https://twitter.com/a_generic_user'; const url = 'https://x.com/a_generic_user';
expect(normalizeTwitter(url)).toEqual(url); expect(normalizeTwitter(url)).toEqual(url);
}); });
test('adds the handle to twitter.com if it is not a url', () => { test('adds the handle to x.com if it is not a url', () => {
const handle = '@a_generic_user'; const handle = '@a_generic_user';
expect(normalizeTwitter(handle)).toEqual( expect(normalizeTwitter(handle)).toEqual('https://x.com/a_generic_user');
'https://twitter.com/a_generic_user'
);
}); });
test('returns undefined if that is the input', () => { test('returns undefined if that is the input', () => {
expect(normalizeTwitter('')).toBeUndefined(); expect(normalizeTwitter('')).toBeUndefined();

View File

@@ -35,7 +35,7 @@ export const normalizeTwitter = (
try { try {
new URL(handleOrUrl); new URL(handleOrUrl);
} catch { } catch {
url = `https://twitter.com/${handleOrUrl.replace(/^@/, '')}`; url = `https://x.com/${handleOrUrl.replace(/^@/, '')}`;
} }
return url ?? handleOrUrl; return url ?? handleOrUrl;
}; };

View File

@@ -930,7 +930,7 @@
"linkedin": "Link to {{username}}'s LinkedIn", "linkedin": "Link to {{username}}'s LinkedIn",
"github": "Link to {{username}}'s GitHub", "github": "Link to {{username}}'s GitHub",
"website": "Link to {{username}}'s website", "website": "Link to {{username}}'s website",
"twitter": "Link to {{username}}'s Twitter", "twitter": "Link to {{username}}'s X",
"next-month": "Go to next month", "next-month": "Go to next month",
"previous-month": "Go to previous month", "previous-month": "Go to previous month",
"first-page": "Go to first page", "first-page": "Go to first page",

View File

@@ -240,7 +240,7 @@ const ShareCertBtns = ({
block={true} block={true}
size='large' size='large'
variant='primary' variant='primary'
href={`https://twitter.com/intent/tweet?text=${t('profile.tweet', { href={`https://x.com/intent/post?text=${t('profile.tweet', {
certTitle: urlFriendlyCertTitle, certTitle: urlFriendlyCertTitle,
certURL certURL
})}`} })}`}

View File

@@ -204,12 +204,10 @@ const InternetSettings = ({
controlId='internet-twitter' controlId='internet-twitter'
validationState={twitterValidation} validationState={twitterValidation}
> >
<ControlLabel htmlFor='internet-twitter-input'> <ControlLabel htmlFor='internet-twitter-input'>X</ControlLabel>
Twitter
</ControlLabel>
<FormControl <FormControl
onChange={createHandleChange('twitter')} onChange={createHandleChange('twitter')}
placeholder='https://twitter.com/user-name' placeholder='https://x.com/user-name'
type='url' type='url'
value={formValues.twitter} value={formValues.twitter}
id='internet-twitter-input' id='internet-twitter-input'

View File

@@ -26,7 +26,7 @@ export const ShareTemplate: React.ComponentType<ShareRedirectProps> = ({
<FontAwesomeIcon <FontAwesomeIcon
icon={faXTwitter} icon={faXTwitter}
size='1x' size='1x'
aria-label='twitterIcon' aria-label='xIcon'
aria-hidden='true' aria-hidden='true'
/> />
{t('buttons.share-on-x')} {t('buttons.share-on-x')}

View File

@@ -7,9 +7,9 @@ export const nextLine = '%0A';
const freecodecampLearnDomainURL = 'www.freecodecamp.org/learn'; const freecodecampLearnDomainURL = 'www.freecodecamp.org/learn';
export const twitterData = { export const twitterData = {
action: 'intent/tweet', action: 'intent/post',
domain: 'twitter.com', domain: 'x.com',
developerDomainURL: 'https://developer.twitter.com' developerDomainURL: 'https://developer.x.com'
}; };
export const blueSkyData = { export const blueSkyData = {

View File

@@ -99,7 +99,7 @@ test.describe('Certification page - Non Microsoft', () => {
await expect(twitterLink).toBeVisible(); await expect(twitterLink).toBeVisible();
await expect(twitterLink).toHaveAttribute( await expect(twitterLink).toHaveAttribute(
'href', 'href',
`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` `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`
); );
const projectLinks = certLink.getByTestId('project-links'); const projectLinks = certLink.getByTestId('project-links');
@@ -259,7 +259,7 @@ test.describe('Certification page - Microsoft', () => {
await expect(twitterLink).toBeVisible(); await expect(twitterLink).toBeVisible();
await expect(twitterLink).toHaveAttribute( await expect(twitterLink).toHaveAttribute(
'href', 'href',
'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' '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'
); );
const projectLinks = certLink.getByTestId('project-links'); const projectLinks = certLink.getByTestId('project-links');

View File

@@ -60,8 +60,8 @@ test.describe('Your Internet Presence', () => {
}, },
{ {
name: 'twitter', name: 'twitter',
url: 'https://twitter.com/certified-user', url: 'https://x.com/certified-user',
label: 'Twitter', label: 'X',
checkTestId: settingsPageElement.twitterCheckmark checkTestId: settingsPageElement.twitterCheckmark
}, },
{ {