Skip to content

Commit bfb9e82

Browse files
committed
Merge branch 'develop' into tco23-BS-comps
2 parents e2e0f91 + 13829af commit bfb9e82

File tree

6 files changed

+87
-32
lines changed

6 files changed

+87
-32
lines changed

__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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ async function onExpressJsSetup(server) {
185185
+ ` ${config.CDN.PUBLIC}`
186186
+ ' https://d1of0acg2orgco.cloudfront.net'
187187
+ ' https://d24oibycet9bsb.cloudfront.net'
188+
+ ' https://d1mwkvp2xbqfs9.cloudfront.net'
188189
+ ' https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com;'
189190
+ " frame-src 'self'"
190191
+ ` ${config.URL.AUTH}`

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
}

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/ProfilePage/Header/index.jsx

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@
33
*/
44
import React, { useEffect, useState } from 'react';
55
import PT from 'prop-types';
6+
import { connect } from 'react-redux';
67

8+
import { actions } from 'topcoder-react-lib';
79
import { isomorphy } from 'topcoder-react-utils';
810

9-
// import VerifiedBadge from 'assets/images/profile/verified-badge.svg';
10-
// import InfoIcon from 'assets/images/profile/ico-info.svg';
11-
// import Tooltip from 'components/Tooltip';
11+
import VerifiedBadge from 'assets/images/profile/verified-badge.svg';
12+
import InfoIcon from 'assets/images/profile/ico-info.svg';
13+
import Tooltip from 'components/Tooltip';
1214

1315
import './styles.scss';
1416

15-
const ProfileHeader = ({ info }) => {
17+
const verifiedBadgeLookerId = '3322';
18+
19+
const ProfileHeader = ({ getLookerDone, lookerInfo, info }) => {
1620
const [imageUrl, setimageUrl] = useState();
21+
const [isMemberVerified, setIsMemberVerified] = useState(false);
22+
const { handle } = info;
1723

1824
useEffect(() => {
1925
let url = '';
@@ -25,16 +31,29 @@ const ProfileHeader = ({ info }) => {
2531
setimageUrl(url);
2632
}, []);
2733

34+
useEffect(() => {
35+
if (!lookerInfo || lookerInfo.error) {
36+
getLookerDone(verifiedBadgeLookerId);
37+
}
38+
}, []);
39+
40+
useEffect(() => {
41+
if (!lookerInfo || lookerInfo.error) {
42+
return;
43+
}
44+
const { lookerData } = lookerInfo;
45+
const currentUserData = lookerData.find(x => x['user.handle'] === handle);
46+
setIsMemberVerified(currentUserData && currentUserData['member_verification.status'] === 'Verified');
47+
}, [lookerInfo]);
48+
2849
const loadImageError = () => {
2950
setimageUrl(null);
3051
};
3152

32-
// const tooltipContent = (
33-
// <div styleName="tooltip-content">verified member</div>
34-
// );
53+
const tooltipContent = (
54+
<div styleName="tooltip-content">verified member</div>
55+
);
3556

36-
const { handle } = info;
37-
// const isMemberVerified = true;
3857

3958
return (
4059
<div styleName="container">
@@ -55,24 +74,22 @@ const ProfileHeader = ({ info }) => {
5574
{handle}
5675
</div>
5776

58-
{/* { */}
59-
{/* isMemberVerified && ( */}
60-
{/* <div styleName="verified-member"> */}
61-
{/* <VerifiedBadge /> */}
62-
63-
{/* <span>verified member</span> */}
64-
65-
{/* <div styleName="info"> */}
66-
{/* <Tooltip */}
67-
{/* content={tooltipContent} */}
68-
{/* trigger={['hover', 'focus']} */}
69-
{/* > */}
70-
{/* <InfoIcon /> */}
71-
{/* </Tooltip> */}
72-
{/* </div> */}
73-
{/* </div> */}
74-
{/* ) */}
75-
{/* } */}
77+
{isMemberVerified && (
78+
<div styleName="verified-member">
79+
<VerifiedBadge />
80+
81+
<span>verified member</span>
82+
83+
<div styleName="info">
84+
<Tooltip
85+
content={tooltipContent}
86+
trigger={['hover', 'focus']}
87+
>
88+
<InfoIcon />
89+
</Tooltip>
90+
</div>
91+
</div>
92+
)}
7693
</div>
7794

7895
</div>
@@ -85,8 +102,34 @@ ProfileHeader.defaultProps = {
85102
info: {},
86103
};
87104

105+
function mapStateToProps(state) {
106+
const {
107+
looker: {
108+
dataSet,
109+
},
110+
} = state;
111+
return {
112+
lookerInfo: dataSet[verifiedBadgeLookerId],
113+
};
114+
}
115+
116+
function mapDispatchToProps(dispatch) {
117+
return {
118+
getLookerDone: (lookerId) => {
119+
dispatch(actions.looker.getLookerDone(lookerId));
120+
},
121+
};
122+
}
123+
88124
ProfileHeader.propTypes = {
89125
info: PT.shape(),
126+
lookerInfo: PT.shape().isRequired,
127+
getLookerDone: PT.func.isRequired,
90128
};
91129

92-
export default ProfileHeader;
130+
const Container = connect(
131+
mapStateToProps,
132+
mapDispatchToProps,
133+
)(ProfileHeader);
134+
135+
export default Container;

0 commit comments

Comments
 (0)