From cef3c7c10ae5cdb17798fabf4ed17483e8dd47da Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Mon, 12 Oct 2020 22:06:35 -0300
Subject: [PATCH 1/8] Added new Forums Object to Challenge Details
---
.../Header/TabSelector/index.jsx | 27 ++++++++++++++-----
.../Specification/SideBar/index.jsx | 24 ++++++++++++++---
.../challenge-detail/Specification/index.jsx | 5 ++++
3 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index 98df8985c4..17025a1d8b 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -36,6 +36,9 @@ export default function ChallengeViewSelector(props) {
const numOfSub = numOfSubmissions + (numOfCheckpointSubmissions || 0);
const forumId = _.get(challenge, 'legacy.forumId') || 0;
+ const discuss = (_.get(challenge, 'discussions') || 0).filter(d => (
+ d.type === 'challenge' && !_.isEmpty(d.url)
+ ));
const roles = _.get(challenge, 'userDetails.roles') || [];
const isDesign = trackLower === 'design';
@@ -174,13 +177,23 @@ export default function ChallengeViewSelector(props) {
) : null
}
{ (hasRegistered || Boolean(roles.length))
- && (
-
- CHALLENGE FORUM
-
+ && _.isEmpty(discuss)
+ ? (
+
+ CHALLENGE FORUM
+
+ ) : (
+ discuss.map(d => (
+
+ {d.name}
+
+ ))
)
}
diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
index 42912944d5..5db6afaa97 100644
--- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
@@ -21,6 +21,7 @@ export default function SideBar({
eventDetail,
shareable,
forumLink,
+ discuss,
hasRegistered,
reviewType,
isDesign,
@@ -266,10 +267,25 @@ export default function SideBar({
Questions?
-
- Ask in the Challenge Discussion Forums.
-
+ {_.isEmpty(discuss) && (
+
+ Ask in the Challenge Discussion Forums.
+
+ )}
+ {!_.isEmpty(discuss) && (
+
+ )}
SOURCE FILES:
@@ -351,6 +367,7 @@ export default function SideBar({
SideBar.defaultProps = {
eventDetail: null,
+ discuss: [],
documents: undefined,
hasRegistered: false,
reviewType: 'COMMUNITY',
@@ -376,6 +393,7 @@ SideBar.propTypes = {
documents: PT.arrayOf(PT.shape()),
shareable: PT.bool.isRequired,
forumLink: PT.string.isRequired,
+ discuss: PT.arrayOf(PT.shape()),
hasRegistered: PT.bool,
reviewType: PT.string,
isDesign: PT.bool,
diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx
index 9f5608931a..7fb345bdd6 100644
--- a/src/shared/components/challenge-detail/Specification/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/index.jsx
@@ -76,6 +76,10 @@ export default function ChallengeDetailsView(props) {
codeRepo = codeRepoData.value;
}
+ const discuss = (_.get(challenge, 'discussions') || 0).filter(d => (
+ d.type === 'challenge' && !_.isEmpty(d.url)
+ ));
+
let forumLink = track.toLowerCase() === 'design'
? `/?module=ThreadList&forumID=${forumId}`
: `/?module=Category&categoryID=${forumId}`;
@@ -351,6 +355,7 @@ export default function ChallengeDetailsView(props) {
challengesUrl={challengesUrl}
legacyId={legacyId}
forumLink={forumLink}
+ discuss={discuss}
documents={documents}
hasRegistered={hasRegistered}
isDesign={track.toLowerCase() === 'design'}
From bef822ad5a53fd63dbec577a1386df659d204780 Mon Sep 17 00:00:00 2001
From: Luiz Ricardo Rodrigues
Date: Mon, 12 Oct 2020 22:08:24 -0300
Subject: [PATCH 2/8] ci: deploy issue-5041 to QA
Issue: #5041
---
.circleci/config.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index cada900bd7..7b1b1c0e01 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -245,6 +245,7 @@ workflows:
branches:
only:
- develop
+ - issue-5041
# This is beta env for production soft releases
- "build-prod-beta":
context : org-global
From 9cfd6abd6f7d1a88c32b06bf37daedb4bd7f66f2 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Wed, 4 Nov 2020 02:31:42 -0300
Subject: [PATCH 3/8] Vanilla Forums - Fix challenge discussion validation
---
.../components/challenge-detail/Header/TabSelector/index.jsx | 2 +-
src/shared/components/challenge-detail/Specification/index.jsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index 17025a1d8b..13023d574b 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -36,7 +36,7 @@ export default function ChallengeViewSelector(props) {
const numOfSub = numOfSubmissions + (numOfCheckpointSubmissions || 0);
const forumId = _.get(challenge, 'legacy.forumId') || 0;
- const discuss = (_.get(challenge, 'discussions') || 0).filter(d => (
+ const discuss = _.get(challenge, 'discussions', []).filter(d => (
d.type === 'challenge' && !_.isEmpty(d.url)
));
const roles = _.get(challenge, 'userDetails.roles') || [];
diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx
index 7fb345bdd6..8f2f18d150 100644
--- a/src/shared/components/challenge-detail/Specification/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/index.jsx
@@ -76,7 +76,7 @@ export default function ChallengeDetailsView(props) {
codeRepo = codeRepoData.value;
}
- const discuss = (_.get(challenge, 'discussions') || 0).filter(d => (
+ const discuss = _.get(challenge, 'discussions', []).filter(d => (
d.type === 'challenge' && !_.isEmpty(d.url)
));
From 1d84d94ddad61037ac180345b7a4aaf69ed261c1 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Wed, 4 Nov 2020 02:32:09 -0300
Subject: [PATCH 4/8] Vanilla Forums - Update discuss name
---
.../components/challenge-detail/Header/TabSelector/index.jsx | 2 +-
.../components/challenge-detail/Specification/SideBar/index.jsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index 13023d574b..a05c127d99 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -191,7 +191,7 @@ export default function ChallengeViewSelector(props) {
href={d.url}
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
>
- {d.name}
+ CHALLENGE DISCUSSION
))
)
diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
index 5db6afaa97..b80de3349f 100644
--- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
@@ -280,7 +280,7 @@ export default function SideBar({
- {d.name}
+ CHALLENGE DISCUSSION
))}
From 3f02a636bdaa74bd06119be1ebc9d114b5b92594 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Fri, 6 Nov 2020 14:43:28 -0300
Subject: [PATCH 5/8] ci: deploy new-forums to QA env
---
.circleci/config.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7b1b1c0e01..e1b8736c41 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -245,7 +245,7 @@ workflows:
branches:
only:
- develop
- - issue-5041
+ - new-forums
# This is beta env for production soft releases
- "build-prod-beta":
context : org-global
From 4f90c372380d847aae0a1e9295d47893e499a99d Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Mon, 9 Nov 2020 18:14:16 -0300
Subject: [PATCH 6/8] Forums - Open in new window
---
.../challenge-detail/Header/TabSelector/index.jsx | 4 ++++
.../challenge-detail/Specification/SideBar/index.jsx | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index a05c127d99..4a3c73e159 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -182,6 +182,8 @@ export default function ChallengeViewSelector(props) {
CHALLENGE FORUM
@@ -190,6 +192,8 @@ export default function ChallengeViewSelector(props) {
CHALLENGE DISCUSSION
diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
index b80de3349f..3163c10661 100644
--- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
@@ -268,7 +268,11 @@ export default function SideBar({
Questions?
{_.isEmpty(discuss) && (
-
+
Ask in the Challenge Discussion Forums.
)}
@@ -279,6 +283,8 @@ export default function SideBar({
CHALLENGE DISCUSSION
From 69f2176640e4f2f75ae6e6fffe1044adb3c0aa7b Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Thu, 12 Nov 2020 01:35:30 -0300
Subject: [PATCH 7/8] Challenge Forums - Fix logical if user registered.
---
.../Header/TabSelector/index.jsx | 53 ++++++++++---------
1 file changed, 29 insertions(+), 24 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index 4a3c73e159..eb95429a9d 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -176,30 +176,35 @@ export default function ChallengeViewSelector(props) {
) : null
}
- { (hasRegistered || Boolean(roles.length))
- && _.isEmpty(discuss)
- ? (
-
- CHALLENGE FORUM
-
- ) : (
- discuss.map(d => (
-
- CHALLENGE DISCUSSION
-
- ))
- )
- }
+ { (() => {
+ if (hasRegistered || Boolean(roles.length)) {
+ if (_.isEmpty(discuss)) {
+ return (
+
+ CHALLENGE FORUM
+
+ );
+ }
+ return (
+ discuss.map(d => (
+
+ CHALLENGE DISCUSSION
+
+ ))
+ );
+ }
+ return '';
+ })()}
);
From 4c1767fcf4200444c7d527d9ad8066f6add21b78 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Thu, 12 Nov 2020 09:06:58 -0300
Subject: [PATCH 8/8] Hide forum tab if haven't a forumId or discussions
---
.../Header/TabSelector/index.jsx | 28 ++++++++++---------
.../Specification/SideBar/index.jsx | 28 ++++++++++---------
.../challenge-detail/Specification/index.jsx | 10 ++++---
3 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index eb95429a9d..0445677aa7 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -178,7 +178,21 @@ export default function ChallengeViewSelector(props) {
}
{ (() => {
if (hasRegistered || Boolean(roles.length)) {
- if (_.isEmpty(discuss)) {
+ if (!_.isEmpty(discuss)) {
+ return (
+ discuss.map(d => (
+
+ CHALLENGE DISCUSSION
+
+ ))
+ );
+ }
+ if (forumId > 0) {
return (
);
}
- return (
- discuss.map(d => (
-
- CHALLENGE DISCUSSION
-
- ))
- );
}
return '';
})()}
diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
index 7b65735a5e..793278de7d 100644
--- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
@@ -322,19 +322,21 @@ export default function SideBar({
pass screening.
-
- Questions?
-
- {_.isEmpty(discuss) && (
-
- Ask in the Challenge Discussion Forums.
-
- )}
-
+ {(forumLink || !_.isEmpty(discuss)) && (
+
+ Questions?
+
+ {_.isEmpty(discuss) && (
+
+ Ask in the Challenge Discussion Forums.
+
+ )}
+
+ )}
{!_.isEmpty(discuss) && (
{ discuss.map(d => (
diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx
index 8f2f18d150..f61d3401ef 100644
--- a/src/shared/components/challenge-detail/Specification/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/index.jsx
@@ -80,10 +80,12 @@ export default function ChallengeDetailsView(props) {
d.type === 'challenge' && !_.isEmpty(d.url)
));
- let forumLink = track.toLowerCase() === 'design'
- ? `/?module=ThreadList&forumID=${forumId}`
- : `/?module=Category&categoryID=${forumId}`;
- forumLink = `${config.URL.FORUMS}${forumLink}`;
+ let forumLink = '';
+ if (forumId > 0) {
+ forumLink = track.toLowerCase() === 'design'
+ ? `/?module=ThreadList&forumID=${forumId}`
+ : `/?module=Category&categoryID=${forumId}`;
+ }
let isWipro = false;
const wiproCommunity = communitiesList.find(x => x.communityId === 'wipro');