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,
profileUI: testUserData.profileUI,
savedChallenges: testUserData.savedChallenges,
twitter: 'https://twitter.com/foobar',
twitter: 'https://x.com/foobar',
bluesky: 'https://bsky.app/profile/foobar',
sendQuincyEmail: testUserData.sendQuincyEmail,
username: testUserData.username,

View File

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

View File

@@ -12,14 +12,12 @@ import {
describe('normalize', () => {
describe('normalizeTwitter', () => {
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);
});
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';
expect(normalizeTwitter(handle)).toEqual(
'https://twitter.com/a_generic_user'
);
expect(normalizeTwitter(handle)).toEqual('https://x.com/a_generic_user');
});
test('returns undefined if that is the input', () => {
expect(normalizeTwitter('')).toBeUndefined();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -99,7 +99,7 @@ test.describe('Certification page - Non Microsoft', () => {
await expect(twitterLink).toBeVisible();
await expect(twitterLink).toHaveAttribute(
'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');
@@ -259,7 +259,7 @@ test.describe('Certification page - Microsoft', () => {
await expect(twitterLink).toBeVisible();
await expect(twitterLink).toHaveAttribute(
'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');

View File

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