Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ exports[`Default render 1`] = `
"title": "Home",
},
Object {
"href": "/members/willFilledByUserName",
"id": "myprofile",
"href": "https://profiles.topcoder-dev.com/huanner",
"id": "profile",
"logged": true,
"title": "My Profile",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-handle___1wDhG"
>
<a
href="https://www.topcoder-dev.com/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
rel="noreferrer"
style={
Object {
Expand Down Expand Up @@ -111,7 +111,7 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-handle___1wDhG"
>
<a
href="https://www.topcoder-dev.com/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
rel="noreferrer"
style={
Object {
Expand Down Expand Up @@ -165,7 +165,7 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-handle___1wDhG"
>
<a
href="https://www.topcoder-dev.com/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
rel="noreferrer"
style={
Object {
Expand Down Expand Up @@ -219,7 +219,7 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-handle___1wDhG"
>
<a
href="https://www.topcoder-dev.com/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
rel="noreferrer"
style={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`Matches shallow shapshot 1`] = `
<div>
<a
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__profile-link___3s9pr"
href="undefined/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
target="_blank"
/>
</div>
Expand Down Expand Up @@ -80,7 +80,7 @@ exports[`Matches shallow shapshot 2`] = `
<div>
<a
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__profile-link___3s9pr"
href="undefined/members/undefined/"
href="https://profiles.topcoder-dev.com/undefined"
target="_blank"
/>
</div>
Expand Down
14 changes: 6 additions & 8 deletions __tests__/shared/components/__snapshots__/Content.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,17 @@ exports[`Matches shallow shapshot 1`] = `

endpoint. Valid links on dev:
<br />
<Link
replace={false}
to="/members/TonyJ"
<a
href="https://profiles.topcoder-dev.com/TonyJ"
>
Profile 1.
</Link>
</a>
<br />
<Link
replace={false}
to="/members/mess"
<a
href="https://profiles.topcoder-dev.com/mess"
>
Profile 2.
</Link>
</a>
</li>
<li>
Stand-alone terms of use page: ‌
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`Matches shallow shapshot shapshot 1 1`] = `
<div>
<a
className="src-shared-components-challenge-detail-Winners-Winner-___style__handle___2klay"
href="undefined/members/test"
href="https://profiles.topcoder-dev.com/test"
target="_blank"
>
test
Expand Down
40 changes: 40 additions & 0 deletions __tests__/shared/utils/url.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
getMemberProfileUrl,
getMenuWithDirectProfileLink,
updateLegacyProfileLinks,
} from 'utils/url';

describe('member profile URLs', () => {
it('uses the configured profile application URL', () => {
expect(getMemberProfileUrl('tourist'))
.toBe('https://profiles.topcoder-dev.com/tourist');
});

it('normalizes the profile entry in a navigation menu', () => {
const menu = [{
id: 'community',
secondaryMenu: [{ id: 'myprofile', href: '/members/placeholder' }],
}];

expect(getMenuWithDirectProfileLink(menu, 'tourist')[0].secondaryMenu[0])
.toEqual({
id: 'profile',
href: 'https://profiles.topcoder-dev.com/tourist',
});
});

it('updates only an exact legacy profile anchor rendered by navigation', () => {
const root = document.createElement('nav');
root.innerHTML = [
'<a href="/members/tourist">Profile</a>',
'<a href="/members/tourist/badges">Badges</a>',
].join('');

updateLegacyProfileLinks(root, 'tourist');

expect(root.querySelector('a').getAttribute('href'))
.toBe('https://profiles.topcoder-dev.com/tourist');
expect(root.querySelectorAll('a')[1].getAttribute('href'))
.toBe('/members/tourist/badges');
});
});
2 changes: 1 addition & 1 deletion automated-smoke-test/config/automation-config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"subMenuUrlsAfterLogin": {
"dashboard": "https://community-app.topcoder-dev.com/my-dashboard",
"myProfile": "https://community-app.topcoder-dev.com/members/tester1234",
"myProfile": "https://profiles.topcoder-dev.com/tester1234",
"payments": "https://community.topcoder-dev.com/PactsMemberServlet?module=PaymentHistory&full_list=false",
"competitiveProgramming": "https://community-app.topcoder-dev.com/community/arena",
"forums": "https://apps.topcoder-dev.com/forums/"
Expand Down
2 changes: 1 addition & 1 deletion automated-smoke-test/config/automation-config-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"subMenuUrlsAfterLogin": {
"dashboard": "http://localhost:3000/my-dashboard",
"myProfile": "http://localhost:3000/members/CustomerUser",
"myProfile": "https://profiles.topcoder-dev.com/CustomerUser",
"payments": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false",
"forums": "https://apps.topcoder.com/forums/"
},
Expand Down
2 changes: 1 addition & 1 deletion automated-smoke-test/config/automation-config-prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"subMenuUrlsAfterLogin": {
"dashboard": "https://www.topcoder.com/my-dashboard",
"myProfile": "https://www.topcoder.com/members/CustomerUser",
"myProfile": "https://profiles.topcoder.com/CustomerUser",
"payments": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false",
"forums": "https://apps.topcoder.com/forums/"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class HeaderPage {
* Gets the notification bell icon
*/
private async getBellIcon() {
const xpath = `//a[contains(@href, '/members/${ConfigHelper.getUserName()}')]/parent::div/parent::div/div[position()=1]`;
const xpath = `//a[contains(@href, 'profiles.topcoder') and contains(@href, '/${ConfigHelper.getUserName()}')]/parent::div/parent::div/div[position()=1]`;
const els = await ElementHelper.getAllElementsByXPath(xpath);
return els[1];
}
Expand Down
4 changes: 2 additions & 2 deletions config/backup-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ module.exports = {
logged: true,
},
{
id: 'myprofile',
id: 'profile',
title: 'My Profile',
href: '/members/willFilledByUserName',
href: 'https://profiles.topcoder-dev.com/willFilledByUserName',
logged: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ module.exports = {
logged: true,
},
{
id: 'myprofile',
id: 'profile',
title: 'My Profile',
href: '/members/willFilledByUserName',
href: 'https://profiles.topcoder-dev.com/willFilledByUserName',
logged: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions config/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ module.exports = {
logged: true,
},
{
id: 'myprofile',
id: 'profile',
title: 'My Profile',
href: '/members/willFilledByUserName?ref=nav',
href: 'https://profiles.topcoder.com/willFilledByUserName',
logged: true,
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/shared/actions/recruitCRM.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { redux } from 'topcoder-react-utils';
import Service from 'services/recruitCRM';
import _ from 'lodash';
import { getCustomField } from 'utils/gigs';
import { getMemberProfileUrl } from 'utils/url';

/**
* Jobs page fetch init
Expand Down Expand Up @@ -86,7 +87,7 @@ function normalizeRecruitPayload(job, payload) {
custom_fields: [
{
field_id: 1,
value: payload.tcProfileLink || (payload.handle ? `https://topcoder.com/members/${payload.handle}` : ''),
value: payload.tcProfileLink || (payload.handle ? getMemberProfileUrl(payload.handle) : ''),
},
{
field_id: 2,
Expand Down
9 changes: 5 additions & 4 deletions src/shared/components/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { isomorphy } from 'topcoder-react-utils';
import { getMemberProfileUrl } from 'utils/url';

import './style.scss';

Expand Down Expand Up @@ -247,13 +248,13 @@ export default function Content() {
endpoint.
Valid links on dev:
<br />
<Link to="/members/TonyJ">
<a href={getMemberProfileUrl('TonyJ')}>
Profile 1.
</Link>
</a>
<br />
<Link to="/members/mess">
<a href={getMemberProfileUrl('mess')}>
Profile 2.
</Link>
</a>
</li>
<li>
Stand-alone terms of use page:
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/GSheet/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import _ from 'lodash';
import React, { Component } from 'react';
import { Scrollbars } from 'react-custom-scrollbars';
import cn from 'classnames';
import { getMemberProfileUrl } from 'utils/url';
import './style.scss';

export default class GSheet extends Component {
Expand Down Expand Up @@ -88,7 +89,7 @@ export default class GSheet extends Component {
{
(config.pick || sheet.rows[0]._sheet.headerValues).map(c => (
<td key={`${record._rowNumber}-${c}`} title={record[c]} styleName="body-row">
{c.toLowerCase() === 'handle' ? (<a styleName="handle-link" href={`${window.origin}/members/${record[c]}`} target="_blank" rel="noreferrer">{record[c]}</a>) : record[c]}
{c.toLowerCase() === 'handle' ? (<a styleName="handle-link" href={getMemberProfileUrl(record[c])} target="_blank" rel="noreferrer">{record[c]}</a>) : record[c]}
</td>
))
}
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/Gigs/GigApply/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import DropdownSkills from 'components/GUIKit/DropdownSkills';
import RadioButton from 'components/GUIKit/RadioButton';
import Checkbox from 'components/GUIKit/Checkbox';
import { getCustomField } from 'utils/gigs';
import { getMemberProfileUrl } from 'utils/url';
import Modal from 'components/Contentful/Modal';
import FilestackFilePicker from 'components/GUIKit/FilePicker';
import Dropdown from 'components/GUIKit/Dropdown';
Expand Down Expand Up @@ -238,11 +239,11 @@ export default function GigApply(props) {
readonly
/>
<TextInput
placeholder="Topcoder Profile (topcoder.com/members/[username])"
placeholder="Topcoder Profile (profiles.topcoder.com/[username])"
label="Topcoder Profile"
onChange={val => onFormInputChange('tcProfileLink', val)}
errorMsg={formErrors.tcProfileLink}
value={formData.handle ? `https://topcoder.com/members/${formData.handle}` : null}
value={formData.handle ? getMemberProfileUrl(formData.handle) : null}
readonly
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React from 'react';
import PT from 'prop-types';
import _ from 'lodash';
import { themr } from 'react-css-super-themr';
import { getMemberProfileUrl } from 'utils/url';

import defaultStyles from './styles.scss';

Expand All @@ -22,7 +23,7 @@ const Track = ({
data.fields.members.map(member => (
<div key={member.fields.handle} className={theme.champion}>
<a
to={`${window.origin}/members/${member.fields.handle}`}
href={getMemberProfileUrl(member.fields.handle)}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
>
{member.fields.handle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from 'react';
import PT from 'prop-types';
import _ from 'lodash';
import { themr } from 'react-css-super-themr';
import { getMemberProfileUrl } from 'utils/url';

import defaultStyles from './styles.scss';

Expand All @@ -20,7 +21,7 @@ const Track = ({
<img src={data.fields.champion.fields.image.fields.file.url} alt="Winner Portrait" />
<div>
<a
to={`${window.origin}/members/${data.fields.champion.fields.handle}`}
href={getMemberProfileUrl(data.fields.champion.fields.handle)}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
>
{data.fields.champion.fields.handle}
Expand All @@ -34,7 +35,7 @@ const Track = ({
data.fields.members.map(member => (
<div key={member.fields.handle} className={theme.finalist}>
<a
to={`${window.origin}/members/${member.fields.handle}`}
href={getMemberProfileUrl(member.fields.handle)}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
>
{member.fields.handle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React from 'react';
import PT from 'prop-types';
import _ from 'lodash';
import { themr } from 'react-css-super-themr';
import { getMemberProfileUrl } from 'utils/url';

import defaultStyles from './styles.scss';

Expand All @@ -17,7 +18,7 @@ const Role = ({ data, theme }) => (
data.members.map(member => (
<div key={member.fields.handle} className={theme.winner}>
<a
to={`${window.origin}/members/${member.fields.handle}`}
href={getMemberProfileUrl(member.fields.handle)}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
>
{member.fields.handle}
Expand Down
Loading
Loading