Skip to content

Release 2021/03/11 (v1.8.2) #5428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 11, 2021
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ workflows:
filters:
branches:
only:
- gigwork-updates
- route-redirects
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
filters:
branches:
only:
- free
- tco-leaderboard-fix
# This is beta env for production soft releases
- "build-prod-beta":
context : org-global
Expand Down
3 changes: 2 additions & 1 deletion src/shared/actions/recruitCRM.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { redux } from 'topcoder-react-utils';
import Service from 'services/recruitCRM';
import _ from 'lodash';
import { getCustomField } from 'utils/gigs';

/**
* Jobs page fetch init
Expand Down Expand Up @@ -60,7 +61,7 @@ function normalizeRecruitPayload(job, payload) {
`Date Available: ${new Date(payload.availFrom).toDateString()}`,
`Heard About Gig: ${payload.reffereal}`,
`Why fit: ${payload.whyFit}`,
`Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(s => s.label).join(',')}`,
`Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(() => getCustomField(job.custom_fields, 'Timezone')).join(',')}`,
`Am I ok to work the duration? ${payload.durationConfirm.filter(s => s.value).map(s => s.label).join(',')}`,
`Notes: ${payload.notes}`,
];
Expand Down
31 changes: 29 additions & 2 deletions src/shared/components/Contentful/Route.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import LoadingIndicator from 'components/LoadingIndicator';
import MetaTags from 'components/MetaTags';
import PT from 'prop-types';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { Route, Switch, Redirect } from 'react-router-dom';
import Viewport from 'components/Contentful/Viewport';
import PasswordScreen from 'components/Contentful/PasswordScreen';
import { isomorphy } from 'topcoder-react-utils';

// Concatenates a base and segment and handles optional trailing slashes
const buildUrl = (base, segment) => `${_.trimEnd(base, '/')}/${_.trim(segment, '/')}`;
Expand Down Expand Up @@ -117,6 +118,29 @@ ChildRoutesLoader.propTypes = {
url: PT.string.isRequired,
};

function RedirectWithStatus({ from, to, status }) {
return (
<Route
render={({ staticContext }) => {
if (to[0] !== '/' && isomorphy.isClientSide()) {
window.location.href = to;
return null;
}
// there is no `staticContext` on the client, so
// we need to guard against that here
if (staticContext) staticContext.status = status;
return <Redirect from={from} to={to} />;
}}
/>
);
}

RedirectWithStatus.propTypes = {
from: PT.string.isRequired,
to: PT.string.isRequired,
status: PT.number.isRequired,
};

export default function ContentfulRoute(props) {
const {
baseUrl,
Expand Down Expand Up @@ -145,7 +169,10 @@ export default function ContentfulRoute(props) {
render={(data) => {
const { fields } = Object.values(data.entries.items)[0];
const url = path || buildUrl(baseUrl, fields.url);
return (
const redirectToUrl = _.trim(fields.redirectToUrl);
return redirectToUrl ? (
<RedirectWithStatus status={301} from={url} to={redirectToUrl} />
) : (
<Route
/* This route prevents fetching data about child routes and their
* rendering, if they already known to not match. */
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/Gigs/GigApply/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function GigApply(props) {
errorMsg={formErrors.email}
value={formData.email}
required
readonly
/>
<TextInput
placeholder="Phone Including Country Code"
Expand Down Expand Up @@ -289,7 +290,7 @@ export default function GigApply(props) {
<div styleName="cta-buttons">
<Link to={`${config.URL.AUTH}/member?retUrl=${encodeURIComponent(retUrl)}`} styleName="primaryBtn">Login</Link>
</div>
<p styleName="regTxt">Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
<p styleName="regTxt">Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>here</a>.</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Gigs/GigDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function GigDetails(props) {
<div styleName="infos-item">
<IconTimezone />
<div styleName="infos-data">
Timezone
Working Hours
<strong>{getCustomField(job.custom_fields, 'Timezone')}</strong>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Gigs/LoginModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function LoginModal({ retUrl, onCancel }) {
LOGIN
</PrimaryButton>
</div>
<p className={modalStyle.regTxt}>Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
<p className={modalStyle.regTxt}>Not a member? It is free to <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>register</a>!</p>
</div>
</Modal>
);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Gigs/ReferralModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function ReferralModal({
LOGIN
</PrimaryButton>
</div>
<p className={modalStyle.regTxt}>Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
<p className={modalStyle.regTxt}>Not a member? It is free to <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>register</a>!</p>
</div>
)}
</Modal>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import ChallengeHistoryModal from 'components/Leaderboard/ChallengeHistoryModal';
import PT from 'prop-types';
import actions from 'actions/leaderboard';
Expand All @@ -14,9 +14,9 @@ function ChallengeHistoryModalContainer({
isCopilot,
isAlgo,
}) {
if (!challenges && !loading) {
useEffect(() => {
getChallengesHistory(dataUrl, competitor);
}
}, [competitor]);

return (
<ChallengeHistoryModal
Expand Down
1 change: 1 addition & 0 deletions src/shared/routes/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function Routes({ communityId }) {
path="/community/(competitive-programming|data-science|design|development|qa)/how-to-compete"
/>
<Redirect
exact
from="/community/gigs"
to="/gigs"
/>
Expand Down
2 changes: 2 additions & 0 deletions src/shared/utils/gigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import _ from 'lodash';
*/
export function getSalaryType(data) {
switch (data.id) {
case 1: return 'monthly';
case 2: return 'annual';
case 3: return 'week';
case 4: return 'daily';
case 5: return 'hourly';
default: return 'n/a';
}
Expand Down