Skip to content

Commit f2ca64f

Browse files
committed
Merge branch 'develop' into reskin
* develop: (38 commits) fix(reskin-profile): test update improvement(reskin-profile): verified badge fix: test snapshots fix: topgear page not loading fix not loading fonts on tco due CSP on staging tables and headings fixes ci: remove develop branch from Dev env fix indexOf on null image ci: deploy develop branch on Dev env ci: on test catch unhandled exceptions Fix CMS-related error for NotFound entries JSON.stringify all objects for error dump JSON.stringify CMS errors ci: on test dump action for inspection improvement(reskin-profile): fix lint error on css improvement(reskin-profile): copilot activity f2f fix test fail add opacity ...
2 parents 0189f74 + 13829af commit f2ca64f

File tree

28 files changed

+1429
-94
lines changed

28 files changed

+1429
-94
lines changed

.circleci/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,14 @@ workflows:
349349
filters:
350350
branches:
351351
only:
352-
- develop
353352
- reskin-profile
354353
# This is alternate dev env for parallel testing
355354
- "build-test":
356355
context : org-global
357356
filters:
358357
branches:
359358
only:
360-
- circleci-fix
359+
- tco23
361360
# This is alternate dev env for parallel testing
362361
- "build-qa":
363362
context : org-global
@@ -380,7 +379,7 @@ workflows:
380379
branches:
381380
only:
382381
- develop
383-
- stat_marathon_match_link
382+
- fix-security-headers
384383
# Production builds are exectuted
385384
# when PR is merged to the master
386385
# Don't change anything in this configuration

__tests__/shared/components/ProfilePage/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`renders a full Profile correctly 1`] = `
55
className="src-shared-components-ProfilePage-___styles__outer-container___3in3p"
66
>
77
<div>
8-
<ProfileHeader
8+
<Connect(ProfileHeader)
99
info={
1010
Object {
1111
"competitionCountryCode": "USA",
@@ -717,7 +717,7 @@ exports[`renders an empty Profile correctly 1`] = `
717717
className="src-shared-components-ProfilePage-___styles__outer-container___3in3p"
718718
>
719719
<div>
720-
<ProfileHeader
720+
<Connect(ProfileHeader)
721721
info={
722722
Object {
723723
"competitionCountryCode": "USA",

__tests__/shared/components/__snapshots__/Content.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ exports[`Matches shallow shapshot 1`] = `
491491
<li>
492492
<Link
493493
replace={false}
494-
to="/__community__/wipro"
494+
to="/__community__/wipro/challenges"
495495
>
496496
TopGear (Wipro) community
497497
</Link>

src/server/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ ts = moment(ts.timestamp).valueOf();
5050
const sw = `sw.js${process.env.NODE_ENV === 'production' ? '' : '?debug'}`;
5151
const swScope = '/challenges'; // we are currently only interested in improving challenges pages
5252

53+
const tcoPattern = new RegExp(/^tco\d{2}\.topcoder(?:-dev)?\.com$/i);
54+
5355
const EXTRA_SCRIPTS = [
5456
`<script type="application/javascript">
5557
if('serviceWorker' in navigator){
@@ -135,13 +137,14 @@ async function onExpressJsSetup(server) {
135137
res.header('Referrer-Policy', 'strict-origin-when-cross-origin');
136138
res.header('Permissions-Policy', 'geolocation=(), microphone=(), camera=()');
137139

138-
if (req.url.startsWith('/__community__/veterans') || req.hostname === 'veterans.topcoder.com') {
140+
if (req.url.startsWith('/__community__/veterans') || req.hostname === 'veterans.topcoder.com' || req.url.startsWith('/__community__/tco') || tcoPattern.test(req.hostname)) {
139141
res.header(
140142
'Content-Security-Policy',
141143
"default-src 'self';"
142144
+ " script-src 'report-sample' 'self' 'unsafe-inline' 'unsafe-eval'"
143145
+ ` ${config.CDN.PUBLIC}`
144146
+ ' http://www.google-analytics.com'
147+
+ ' https://www.google-analytics.com'
145148
+ ' https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com'
146149
+ ' https://assets.ubembed.com'
147150
+ ' https://assets.zendesk.com'
@@ -182,11 +185,13 @@ async function onExpressJsSetup(server) {
182185
+ ` ${config.CDN.PUBLIC}`
183186
+ ' https://d1of0acg2orgco.cloudfront.net'
184187
+ ' https://d24oibycet9bsb.cloudfront.net'
188+
+ ' https://d1mwkvp2xbqfs9.cloudfront.net'
185189
+ ' https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com;'
186190
+ " frame-src 'self'"
187191
+ ` ${config.URL.AUTH}`
188192
+ ' https://www.youtube.com;'
189193
+ " img-src 'self'"
194+
+ ' data:'
190195
+ ` ${config.CDN.PUBLIC}`
191196
+ ' https://cdn.segment.com'
192197
+ ' https://d1of0acg2orgco.cloudfront.net'
@@ -196,11 +201,14 @@ async function onExpressJsSetup(server) {
196201
+ ' https://heapanalytics.com'
197202
+ ' https://q.quora.com'
198203
+ ' https://topcoder-prod-media.s3.amazonaws.com'
204+
+ ' https://topcoder-dev-media.s3.amazonaws.com'
199205
+ ' https://www.facebook.com'
200206
+ ' https://www.google-analytics.com'
201207
+ ' https://www.google.com'
202208
+ ' https://www.googletagmanager.com'
203-
+ ' https://i.ytimg.com;'
209+
+ ' https://i.ytimg.com'
210+
+ ' https://images.contentful.com'
211+
+ ' https://d0.awsstatic.com/logos/;'
204212
+ " manifest-src 'self';"
205213
+ " media-src 'self';"
206214
+ ' report-uri https://623d4c23f90d055298b24042.endpoint.csper.io/?v=0;'

src/server/services/communities.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ export async function getMetadata(communityId) {
116116
if (metadata.groupIds) {
117117
metadata.groupIds = await extendByChildGroups(metadata.groupIds);
118118
}
119+
120+
// FIXME: This is a tempory patch to resolve "Backstage Error" that's showing up on Topgear
121+
// app due to missing "Wipro All" authorized group
122+
// Roll this back as soon as the root cause is fixed
123+
// which is likely either in topcoder-react-lib that handles merging groups (https://github.com/topcoder-platform/topcoder-react-lib/blob/c637525211550bea283390e52490fce7f6dd44a8/src/services/groups.js#L107)
124+
// or Groups Api
125+
if (communityId === 'wipro') {
126+
logger.info('Getting metadata for Topgear. Existing Authorized Groups', JSON.stringify(metadata.authorizedGroupIds));
127+
metadata.authorizedGroupIds = _.uniq(metadata.authorizedGroupIds.concat('b7f7c0f8-8ee8-409e-9e5c-33404983b635'));
128+
logger.info('After adding "Wipro All" group', JSON.stringify(metadata.authorizedGroupIds));
129+
}
119130
getMetadata.cache[communityId] = { data: metadata, timestamp: now };
120131
return _.cloneDeep(metadata);
121132
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"challengeFilter": {
3+
"events": ["tco23"]
4+
},
5+
"communityId": "tco23",
6+
"communityName": "TCO23",
7+
"groupIds": [],
8+
"hideSearch": true,
9+
"logos": [{
10+
"img": "/community-app-assets/themes/tco/TCO23.svg",
11+
"url": "https://tco23.topcoder.com"
12+
}],
13+
"menuItems": [{
14+
"navigationMenu": "6SsceF3R5YuKxsf8XnCM5I"
15+
}],
16+
"newsFeed": "http://www.topcoder.com/feed",
17+
"subdomains": ["tco23"],
18+
"description": "2023 Topcoder Open. The Ultimate Programming & Design Tournament",
19+
"image": "tco23.jpg"
20+
}

src/shared/actions/contentful.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getService } from 'services/contentful';
33
import { config, redux } from 'topcoder-react-utils';
44
import { removeTrailingSlash } from 'utils/url';
55
import { menuItemBuilder, target as urlTarget } from 'utils/contentful';
6-
import { services } from 'topcoder-react-lib';
6+
import { services, logger } from 'topcoder-react-lib';
77

88
const ERRMSG_UNKNOWN_TARGET = 'Unknown action target';
99

@@ -91,15 +91,19 @@ async function getContentDone(operationId, contentId, target, preview, spaceName
9191
environment,
9292
});
9393
let content;
94-
switch (target) {
95-
case TARGETS.ASSETS:
96-
content = await service.getAsset(contentId);
97-
break;
98-
case TARGETS.ENTRIES:
99-
content = await service.getEntry(contentId);
100-
break;
101-
default:
102-
throw new Error(ERRMSG_UNKNOWN_TARGET);
94+
try {
95+
switch (target) {
96+
case TARGETS.ASSETS:
97+
content = await service.getAsset(contentId);
98+
break;
99+
case TARGETS.ENTRIES:
100+
content = await service.getEntry(contentId);
101+
break;
102+
default:
103+
throw new Error(ERRMSG_UNKNOWN_TARGET);
104+
}
105+
} catch (e) {
106+
logger.error('getContentDone error', e);
103107
}
104108

105109
return {
@@ -141,15 +145,19 @@ async function queryContentDone(operationId, queryId, target,
141145
environment,
142146
});
143147
let data;
144-
switch (target) {
145-
case TARGETS.ASSETS:
146-
data = await service.queryAssets(query);
147-
break;
148-
case TARGETS.ENTRIES:
149-
data = await service.queryEntries(query);
150-
break;
151-
default:
152-
throw new Error(ERRMSG_UNKNOWN_TARGET);
148+
try {
149+
switch (target) {
150+
case TARGETS.ASSETS:
151+
data = await service.queryAssets(query);
152+
break;
153+
case TARGETS.ENTRIES:
154+
data = await service.queryEntries(query);
155+
break;
156+
default:
157+
throw new Error(ERRMSG_UNKNOWN_TARGET);
158+
}
159+
} catch (e) {
160+
logger.error('queryContentDone error', e);
153161
}
154162

155163
return {

src/shared/components/Content/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ export default function Content() {
413413
</Link>
414414
</li>
415415
<li>
416-
<Link to="/__community__/wipro">
416+
<Link to="/__community__/wipro/challenges">
417417
TopGear (Wipro) community
418418
</Link>
419419
</li>

src/shared/components/Contentful/ContentBlock/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import generalTheme from './themes/general.scss';
1919
import blobCard from './themes/blobCard.scss';
2020
import TCO20Theme from './themes/TCO20.scss';
2121
import largeCard from './themes/largeCard.scss';
22+
import bracketsTheme from './themes/brackets.scss';
2223

2324
const THEMES = {
2425
Default: defaultTheme,
@@ -31,6 +32,7 @@ const THEMES = {
3132
'Blob Card': blobCard,
3233
TCO20: TCO20Theme,
3334
'Large Card': largeCard,
35+
Brackets: bracketsTheme,
3436
};
3537

3638
/* Loads content block background asset. */
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@import "~styles/mixins";
2+
@import "~components/Contentful/brackets";
3+
4+
.contentWrapper {
5+
display: flex;
6+
margin: 0 auto;
7+
max-width: $screen-lg;
8+
padding: 15px 0;
9+
color: $tc-black;
10+
11+
@include xs-to-sm {
12+
flex-direction: column;
13+
}
14+
}
15+
16+
.container {
17+
align-content: center;
18+
background: white;
19+
padding: 10px 0;
20+
21+
&:nth-child(even) .contentWrapper {
22+
flex-direction: row-reverse;
23+
24+
@include xs-to-sm {
25+
flex-direction: column;
26+
}
27+
}
28+
}
29+
30+
strong a {
31+
font-weight: 600 !important;
32+
}
33+
34+
.content {
35+
flex: 1;
36+
padding: 0;
37+
38+
@include xs-to-md {
39+
padding: 15px;
40+
}
41+
42+
@include roboto-regular;
43+
44+
h1,
45+
h2,
46+
h3,
47+
h4,
48+
h5,
49+
h6 {
50+
color: $tco-black;
51+
}
52+
53+
@include brackets-headers;
54+
@include brackets-content;
55+
}
56+
57+
.image {
58+
flex: 1;
59+
margin: 15px;
60+
61+
img {
62+
width: 100%;
63+
}
64+
}

src/shared/components/Contentful/Route.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function ChildRoutesLoader(props) {
4747
<React.Fragment>
4848
<MetaTags
4949
description={fields.description}
50-
image={fields.thumbnail}
50+
image={fields.socialThumbnail}
5151
siteName={fields.socialSiteName}
5252
socialDescription={fields.socialDescription}
5353
socialTitle={fields.socialTitle}

src/shared/components/Contentful/Tabs/Tabs.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import underlineDarkTheme from './themes/underline-dark.scss';
2727
import verticalTheme from './themes/vertical.scss';
2828
import pillsTheme from './themes/pills.scss';
2929
import underlineBoxTheme from './themes/underline-box.scss';
30+
import bracketsTheme from './themes/brackets.scss';
3031

3132
export const TAB_THEMES = {
3233
Default: defaultTheme,
@@ -38,6 +39,7 @@ export const TAB_THEMES = {
3839
Vertical: verticalTheme,
3940
Pills: pillsTheme,
4041
'Underline box': underlineBoxTheme,
42+
Brackets: bracketsTheme,
4143
};
4244

4345
export default class TabsItemsLoader extends Component {

0 commit comments

Comments
 (0)