Skip to content

Commit c46efeb

Browse files
committed
fix: add vanilla links detection
1 parent f295e53 commit c46efeb

File tree

7 files changed

+58
-16
lines changed

7 files changed

+58
-16
lines changed

.deploy/circleci/token.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ database.password=1nf0rm1x
1212
database.INFORMIXSERVER=informixoltp_tcp
1313
database.locale=en_us.utf8
1414

15-
# context.security.url - URL for JNDI lookup
15+
# context.security.url - URL for JNDI lookup
1616
context.security.url=localhost:11199
1717

1818
## Used by cache.properties
@@ -35,7 +35,7 @@ WINFORMULA_SERVER_NAME=tc.cloud.topcoder.com/winformula
3535
CSF_SERVER_NAME=csf.dev.topcoder.com
3636
CORP_SERVER_NAME=tc.cloud.topcoder.com/corp
3737
SOFTWARE_SERVER_NAME=tcs.cloud.topcoder.com
38-
FORUMS_SERVER_NAME=forums.dev.topcoder.com
38+
FORUMS_SERVER_NAME=vanilla.topcoder-dev.com
3939
HOST_URL=localhost:11199
4040
FORUMS_HOST_URL=jnp://localhost:1199
4141
CONTEST_HOST_URL=63.118.154.180:10099

scripts/auto_pilot/ApplicationServer.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ WINFORMULA_SERVER_NAME=tc.cloud.topcoder.com/winformula
1515
CSF_SERVER_NAME=csf.dev.topcoder.com
1616
CORP_SERVER_NAME=tc.cloud.topcoder.com/corp
1717
SOFTWARE_SERVER_NAME=tcs.cloud.topcoder.com
18-
FORUMS_SERVER_NAME=forums.dev.topcoder.com
18+
FORUMS_SERVER_NAME=vanilla.topcoder-dev.com
1919
HOST_URL=localhost:11199
2020
FORUMS_HOST_URL=localhost:1199
2121
CONTEST_HOST_URL=63.118.154.180:10099

src/main/java/com/cronos/onlinereview/util/ConfigHelper.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ public class ConfigHelper {
588588
*/
589589
private static final String VALID_ISSUERS = "valid_issuers";
590590

591+
/**
592+
* <p>A <code>String</code> providing the name for challenge by legacy id v5 url property.</p>
593+
*/
594+
private static final String CHALLENGE_BY_LEGACY_ID_URL_V5 = "challenge_by_legacy_id_url_v5";
595+
591596
/**
592597
* This member variable holds the submitter role id.
593598
*/
@@ -1053,12 +1058,17 @@ public class ConfigHelper {
10531058
* JWT default expiration time (1 day)
10541059
*/
10551060
private static final int DEFAULT_EXPIRATION_TIME = 60 * 24;
1056-
1061+
10571062
/**
10581063
* New Auth URL for Iframe to refresh the RS256 token
10591064
*/
10601065
private static String newAuthUrl;
10611066

1067+
/**
1068+
* Challenge by Legacy Id URL
1069+
*/
1070+
private static String challengeByLegacyIdUrlV5;
1071+
10621072
static {
10631073
// Obtaining the instance of Configuration Manager
10641074
ConfigManager cfgMgr = new ConfigManager();
@@ -1681,10 +1691,11 @@ public class ConfigHelper {
16811691
} catch (Exception e) {
16821692
preSignedExpTimeMilis = 60 * 60 * 1000;
16831693
}
1684-
1694+
16851695
ConfigManager.Property newAuth = cfgMgr.getPropertyObject(ONLINE_REVIEW_CFG_NS, "new_auth");
16861696
newAuthUrl = newAuth.getValue("new_auth_url");
16871697

1698+
challengeByLegacyIdUrlV5 = cfgMgr.getString(ONLINE_REVIEW_CFG_NS, CHALLENGE_BY_LEGACY_ID_URL_V5);
16881699
} catch (Exception une) {
16891700
System.out.println(une.getMessage());
16901701
une.printStackTrace();
@@ -2559,12 +2570,20 @@ public static String getS3BucketDmz() {
25592570
public static long getPreSignedExpTimeMilis() {
25602571
return preSignedExpTimeMilis;
25612572
}
2562-
2573+
25632574
/**
2564-
* Get new auth url
2565-
* @return url
2575+
* Get new auth url
2576+
* @return url
25662577
*/
25672578
public static String getNewAuthUrl() {
25682579
return newAuthUrl;
25692580
}
2581+
2582+
/**
2583+
* Get challenge by legacy id url
2584+
* @return url
2585+
*/
2586+
public static String getChallengeByLegacyIdUrlV5() {
2587+
return challengeByLegacyIdUrlV5;
2588+
}
25702589
}

src/main/resources/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,4 +2092,7 @@
20922092
<Property name="ApprovalPhaseDefaultReviewersNumber">
20932093
<Value>1</Value>
20942094
</Property>
2095+
<Property name="challenge_by_legacy_id_url_v5">
2096+
<Value>@topcoder_api_base_url_v5@/challenges?legacyId=</Value>
2097+
</Property>
20952098
</Config>

token.properties.local

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ AOLICQ_SERVER_NAME=63.118.154.179
7373
WINFORMULA_SERVER_NAME=tc.cloud.topcoder.com/winformula
7474
CSF_SERVER_NAME=csf.dev.topcoder.com
7575
CORP_SERVER_NAME=www.topcoder-dev.com/corp
76-
SOFTWARE_SERVER_NAME=local.topcoder-dev.com:8443
77-
FORUMS_SERVER_NAME=forums.dev.topcoder.com
76+
SOFTWARE_SERVER_NAME=local.topcoder-dev.com:8080
77+
FORUMS_SERVER_NAME=vanilla.topcoder-dev.com
7878
HOST_URL=localhost:1099
7979
FORUMS_HOST_URL=jnp://localhost:1099
8080
CONTEST_HOST_URL=63.118.154.180:10099
@@ -115,7 +115,7 @@ DOMAIN_AUTH0 = topcoder-dev.auth0.com
115115
#CSF_SERVER_NAME=csf.dev.topcoder.com
116116
#CORP_SERVER_NAME=tc.cloud.topcoder.com/corp
117117
#SOFTWARE_SERVER_NAME=tcs.cloud.topcoder.com
118-
#FORUMS_SERVER_NAME=forums.dev.topcoder.com
118+
#FORUMS_SERVER_NAME=vanilla.topcoder-dev.com
119119
#HOST_URL=localhost:11199
120120
#FORUMS_HOST_URL=jnp://localhost:1199
121121
#CONTEST_HOST_URL=63.118.154.180:10099

web/includes/project/project_info.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</c:if>
3737
<a class="breadcrumbLinks"
3838
href="${viewContestLink}"><or:text key="viewProjectDetails.ViewContest" /></a> |
39-
<a class="breadcrumbLinks"
39+
<a class="breadcrumbLinks projectInfo__forumLink"
4040
href="${forumLink}"><or:text key="viewProjectDetails.DevelopmentForum" /></a></td>
4141
</tr>
4242
</table>

web/jsp/viewProjectDetails.jsp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
--%>
88
<%@ page contentType="text/html;charset=UTF-8" %>
99
<%@ page language="java" isELIgnored="false" %>
10+
<%@ page import="java.text.DecimalFormat,com.topcoder.onlinereview.component.webcommon.ApplicationServer" %>
1011
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
1112
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
1213
<%@ taglib prefix="s" uri="/struts-tags" %>
@@ -77,17 +78,36 @@
7778
);
7879
}
7980
</script>
81+
<script type="text/javascript">
82+
function updateForumLink(projectId) {
83+
return fetch("<%=com.cronos.onlinereview.util.ConfigHelper.getChallengeByLegacyIdUrlV5()%>" + projectId)
84+
.then((response) => response.json())
85+
.then((data) => {
86+
let with_forum = data.filter(item => 'discussions' in item);
87+
let id = with_forum?.[0]?.id;
88+
if (id !== undefined) {
89+
let forumLinkEl = document.querySelector('.projectInfo__forumLink');
90+
return forumLinkEl.href = "https://<%=ApplicationServer.FORUMS_SERVER_NAME%>/categories/" + id;
91+
}
92+
});
93+
}
94+
95+
document.addEventListener("DOMContentLoaded", function(){
96+
let projectId = ${project.id};
97+
updateForumLink(projectId);
98+
});
99+
</script>
80100
</head>
81101
82102
<body>
83103
<div align="center">
84-
104+
85105
<div class="maxWidthBody" align="left">
86106
87107
<jsp:include page="/includes/inc_header.jsp" />
88-
108+
89109
<jsp:include page="/includes/project/project_tabs.jsp" />
90-
110+
91111
<div id="mainMiddleContent">
92112
<div style="position: relative; width: 100%;">
93113
<jsp:include page="/includes/project/project_info.jsp" /><br />
@@ -115,7 +135,7 @@
115135
</div>
116136
</div>
117137
</div>
118-
138+
119139
<jsp:include page="/includes/inc_footer.jsp" />
120140
121141
</div>

0 commit comments

Comments
 (0)