Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit dbfe083

Browse files
authored
Merge pull request #525 from appirio-tech/dev
Fix for adding user to task when group is assigned
2 parents 4dd313a + f1f0e0b commit dbfe083

File tree

9 files changed

+91
-30
lines changed

9 files changed

+91
-30
lines changed

conf/ApplicationServer.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ SSO_HASH_SECRET = @ApplicationServer.SSO_HASH_SECRET@
4545
SSO_DOMAIN = @ApplicationServer.SSO_DOMAIN@
4646

4747
JWT_V3_COOKIE_KEY = @ApplicationServer.JWT_V3_COOKIE_KEY@
48-
JWT_COOKIE_KEY = @ApplicationServer.JWT_COOKIE_KEY@
48+
JWT_COOKIE_KEY = @ApplicationServer.JWT_COOKIE_KEY@
49+
50+
TOPCODER_CONNECT_URL=@TopcoderConnectUrl@

services/contest_service_facade/src/java/main/com/topcoder/service/facade/contest/ejb/ContestServiceFacadeBean.java

+56-14
Original file line numberDiff line numberDiff line change
@@ -2354,6 +2354,22 @@ private XMLGregorianCalendar getXMLGregorianCalendar(Date date) {
23542354
}
23552355
}
23562356

2357+
/**
2358+
* <p>
2359+
* Adds the specified number of minutes to the given date and returns the result.
2360+
* </p>
2361+
*
2362+
* @param date The Date to which to add the given minutes amount
2363+
* @param minutes The number of minutes to add to the given date (Can be negative)
2364+
* @return The resulting date = input date + number of minutes
2365+
*/
2366+
private Date addMinutesToDate(Date date, int minutes) {
2367+
Calendar cal = Calendar.getInstance();
2368+
cal.setTime(date);
2369+
cal.add(Calendar.MINUTE, minutes);
2370+
return cal.getTime();
2371+
}
2372+
23572373
/**
23582374
* <p>
23592375
* Processes the contest sale.
@@ -4043,13 +4059,18 @@ else if (isDevContest) {
40434059
if (useExistingAsset && assetDTO.getForum() != null) {
40444060
forumId = assetDTO.getForum().getJiveCategoryId();
40454061
} else {
4046-
if (!isStudio(contest)) {
4047-
// software contest
4048-
forumId = createForum(tcSubject, assetDTO, tcSubject.getUserId(),
4049-
contest.getProjectHeader().getProjectCategory().getId());
4062+
if(isPrivateProject(contest)) { // no forum to be created for private tasks
4063+
logger.debug("Skip forum creation for private task: "+assetDTO.getName());
4064+
forumId = -1;
40504065
} else {
4051-
// studio contest
4052-
forumId = createStudioForum(assetDTO.getName(), tcSubject.getUserId());
4066+
if (!isStudio(contest)) {
4067+
// software contest
4068+
forumId = createForum(tcSubject, assetDTO, tcSubject.getUserId(),
4069+
contest.getProjectHeader().getProjectCategory().getId());
4070+
} else {
4071+
// studio contest
4072+
forumId = createStudioForum(assetDTO.getName(), tcSubject.getUserId());
4073+
}
40534074
}
40544075
}
40554076
}
@@ -5516,8 +5537,9 @@ public Set<Long> updatePreRegister(TCSubject tcSubject, SoftwareCompetition cont
55165537

55175538
removedUsers = uploadExternalServices.removeSubmitters(contest.getId(), removedUsers,
55185539
String.valueOf(tcSubject.getUserId()));
5519-
// remove forum
5520-
if (createForum) {
5540+
// remove forum user permissions for public projects.
5541+
// private tasks do not have forums created
5542+
if (createForum && !isPrivateProject(contest)) {
55215543
try {
55225544
forumId = contest.getAssetDTO().getForum().getJiveCategoryId();
55235545
forum = getSoftwareForums();
@@ -5536,7 +5558,7 @@ public Set<Long> updatePreRegister(TCSubject tcSubject, SoftwareCompetition cont
55365558
for (Long member : preRegisterMembers) {
55375559
try {
55385560
this.addSubmitter(tcSubject, contest.getId(), member);
5539-
if (createForum) {
5561+
if (createForum && !isPrivateProject(contest)) {
55405562
forum.assignRole(member, userRoleId);
55415563
}
55425564
addedUsers.add(member);
@@ -9862,25 +9884,30 @@ public void closeSoftwareContest(TCSubject tcSubject, long projectId, long winne
98629884
DataHandler dataHandler = new DataHandler(new FileDataSource(mockSubmissionFilePath + mockSubmissionFileName));
98639885
long submissionId = uploadSubmission(winnerId, contest.getId(), mockSubmissionFileName, dataHandler);
98649886

9865-
// close submission and review phase
9887+
Date currentDate = new Date();
9888+
// subtract one minute from the current date
9889+
// this will be used to set the registration start/end dates
9890+
Date oneMinuteEarlier = addMinutesToDate(currentDate, -1);
9891+
9892+
// close registration, submission and review phases
98669893
com.topcoder.project.phases.Phase submissionPhase = null;
98679894
com.topcoder.project.phases.Phase reviewPhase = null;
98689895
for (com.topcoder.project.phases.Phase phase : phases) {
98699896
if (PROJECT_SUBMISSION_PHASE_NAME.equals(phase.getPhaseType().getName())) {
98709897
if (phaseNeedToUpdate && !phaseHasClosed) {
98719898
// submission is scheduled
9872-
phase.setActualStartDate(new Date());
9873-
phase.setActualEndDate(new Date());
9899+
phase.setActualStartDate(currentDate);
9900+
phase.setActualEndDate(currentDate);
98749901
} else if (!phaseNeedToUpdate) {
98759902
// phase already open
9876-
phase.setActualEndDate(new Date());
9903+
phase.setActualEndDate(currentDate);
98779904
}
98789905
phase.setPhaseStatus(PhaseStatus.CLOSED);
98799906
submissionPhase = phase;
98809907
} else if (PROJECT_REVIEW_PHASE_NAME.equals(phase.getPhaseType().getName())
98819908
|| PROJECT_ITERATIVE_REVIEW_PHASE_NAME.equals(phase.getPhaseType().getName())) {
98829909
if (phase.getPhaseStatus().getId() == PhaseStatus.SCHEDULED.getId()) {
9883-
phase.setActualStartDate(new Date());
9910+
phase.setActualStartDate(currentDate);
98849911
phase.setScheduledEndDate(null);
98859912
phase.setScheduledStartDate(phase.calcStartDate());
98869913
phase.setScheduledEndDate(phase.calcEndDate());
@@ -9890,6 +9917,21 @@ public void closeSoftwareContest(TCSubject tcSubject, long projectId, long winne
98909917
// skiping closed iterative review
98919918
reviewPhase = phase;
98929919
}
9920+
} else if (PROJECT_REGISTRATION_PHASE_NAME.equals(phase.getPhaseType().getName())) {
9921+
if (phase.getActualStartDate() != null) {
9922+
// The registration phase is already started, we only need to set the end date if not set already
9923+
// The actual end date is set to one minute earlier than the submission phase
9924+
// This will ensure that the phases are shown in the correct order in Online Review
9925+
if(phase.getActualEndDate() == null ) {
9926+
phase.setActualEndDate(oneMinuteEarlier);
9927+
}
9928+
} else {
9929+
// The registration phase is not opened yet (start date is in the future)
9930+
phase.setActualStartDate(oneMinuteEarlier);
9931+
phase.setActualEndDate(oneMinuteEarlier);
9932+
}
9933+
// Set the registration status to closed
9934+
phase.setPhaseStatus(PhaseStatus.CLOSED);
98939935
}
98949936
}
98959937
projectPhases.setPhases(new HashSet<com.topcoder.project.phases.Phase>(Arrays.asList(phases)));

src/java/main/com/topcoder/direct/services/configs/ServerConfiguration.java

+5
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ public class ServerConfiguration extends ApplicationServer {
5858
public static String JWT_V3_COOKIE_KEY = bundle.getProperty("JWT_V3_COOKIE_KEY", "v3jwt");
5959

6060
public static String JWT_COOKIE_KEY = bundle.getProperty("JWT_COOKIE_KEY", "tcjwt");
61+
62+
/**
63+
* The Topcoder Connect URL
64+
*/
65+
public static String TOPCODER_CONNECT_URL = bundle.getProperty("TOPCODER_CONNECT_URL", "https://connect.topcoder.com");
6166
}

src/java/main/com/topcoder/direct/services/view/action/contest/launch/GetGroupMemberAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private List<GroupMember> getGroupMemberByGid(String gid) throws Exception {
232232
}
233233

234234
jsonNode = objectMapper.readTree(entity.getContent());
235-
List<GroupMember> groupMembers = objectMapper.readValue(jsonNode.path("result"),
235+
List<GroupMember> groupMembers = objectMapper.readValue(jsonNode,
236236
new TypeReference<List<GroupMember>>(){});
237237
for (GroupMember groupMember : groupMembers) {
238238
result.add(groupMember);

src/web/WEB-INF/includes/launch/contestSelection.jsp

+2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,11 @@
133133
</s:iterator>
134134
</select>
135135
</div>
136+
<!-- Removing ability to create Direct Project
136137
<div class="addNew addNewBilling">
137138
<a href="javascript:;" class="button6" id="addNewProject"><span class="left"><span class="right">ADD NEW</span></span></a>
138139
</div>
140+
-->
139141
</div>
140142

141143
<!-- MM Type -->

src/web/WEB-INF/includes/newHeader.jsp

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
-
2626
- Version 1.7 (TOPCODER - REMOVE TASKS TAB IN DIRECT APP)
2727
- - Remove tasks tab
28-
-
29-
- Version 1.4 (Quick72Hrs!! Topcoder - Remove VM Management Feature In Direct App version 1.0)
30-
- remove the vm related things
28+
-
29+
- Version 1.4 (Quick72Hrs!! Topcoder - Remove VM Management Feature In Direct App version 1.0)
30+
- remove the vm related things
3131
-
3232
- Description: The new cockpit header and navigation.
3333
--%>
3434
<%@ page import="com.topcoder.direct.services.configs.ServerConfiguration" %>
3535
<%@ include file="/WEB-INF/includes/taglibs.jsp" %>
3636

37+
<c:set var="TCConnectURL" value="<%=ServerConfiguration.TOPCODER_CONNECT_URL%>"/>
38+
3739
<!-- topcoder maintenance module -->
3840
<div id="topcoder-maintenance-notification">
3941
<div class="content">
@@ -132,7 +134,7 @@
132134

133135
<ul>
134136
<li>
135-
<a class="first" href="<s:url action="createNewProject" namespace="/"/>">Start New</a>
137+
<a class="first" href="${TCConnectURL}" target="_blank">Start New</a>
136138
</li>
137139
<s:if test="%{#session.currentSelectDirectProjectID > 0 && sessionData.currentProjectContext.name != null}">
138140
<input type="hidden" name="topNavCurrentProjectId" value="<s:property value='%{#session.currentSelectDirectProjectID}'/>"/>
@@ -422,7 +424,7 @@
422424
<c:if test="${requestScope.CURRENT_TAB eq 'enterprise' and !requestScope.NO_ENTERPRISE_DASHBOARD_TOP}">
423425
<div class="topBtns" id="enterpriseDashboardTop">
424426
<a href="${ctx}/copilot/launchCopilotContest" class="copilot" title="Finds a TopCoder Copilot for your project">Get a Copilot</a>
425-
<a href="<s:url action="createNewProject" namespace="/"/>" class="start" title="Starts a new project">Start a Project</a>
427+
<a href="${TCConnectURL}" target="_blank" class="start" title="Starts a new project">Start a Project</a>
426428
<a href="${ctx}/launch/home" class="launch" title="Launch a new challenge for your project">Launch Challenge</a>
427429
</div>
428430
</c:if>

src/web/WEB-INF/includes/right.jsp

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@
3232
- the data via ajax.
3333
-
3434
--%>
35+
<%@ page import="com.topcoder.direct.services.configs.ServerConfiguration" %>
3536
<%@ include file="/WEB-INF/includes/taglibs.jsp" %>
3637

38+
<c:set var="TCConnectURL" value="<%=ServerConfiguration.TOPCODER_CONNECT_URL%>"/>
39+
3740
<div id="area2" class="dashboardPage"><!-- the right column -->
3841

3942
<div class="newSidebar">
4043
<div class="topBtns">
4144
<a href="${ctx}/copilot/launchCopilotContest" class="copilot"
4245
title="Finds a TopCoder Copilot for your project">Get a Copilot</a>
43-
<a href="<s:url action="createNewProject" namespace="/"/>" class="start" title="Starts a new project">Start
44-
a Project</a>
46+
<a href="${TCConnectURL}" target="_blank" class="start" title="Starts a new project">Start a Project</a>
4547
<a href="${ctx}/launch/home" class="launch" title="Launch a new challenge for your project">Launch
4648
Challenge</a>
4749
</div>

token.properties.docker

+9-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
@payFlowPartner@=PayPal
106106
@payFlowVendor@=tcTestAccount2
107107
@payFlowPassword@=password123
108-
@createForum@=false
108+
@createForum@=true
109109

110110
@userBeanProviderUrl@=jnp://localhost:1199
111111
@projectBeanProviderUrl@=jnp://localhost:1199
@@ -322,7 +322,7 @@
322322
@DOMAIN_AUTH0@ = sma.auth0.com
323323
@CLIENT_ID_AUTH0@ =
324324
@CLIENT_SECRET_AUTH0@ =
325-
@JWT_V3_SECRET@ =
325+
@JWT_V3_SECRET@ = secret
326326
@REG_SERVER_NAME@= tc.cloud.topcoder.com
327327
@LDAP_AUTH0_CONNECTION_NAME@=vm-ldap-connection
328328
@JWT_VALID_ISSUERS@ = https://api.topcoder.com, https://sma.auth0.com, https://newtc.auth0.com, https://topcoder-newauth.auth0.com/
@@ -337,16 +337,19 @@
337337
@ApplicationServer.JWT_COOKIE_KEY@=tcjwt_vm
338338
@ApplicationServer.JWT_V3_COOKIE_KEY@=v3jwt
339339

340-
@memberSearchApiUrl@=https://tc-api.cloud.topcoder.com:8443/v3/members/_suggest/
340+
@memberSearchApiUrl@=http://cockpit.cloud.topcoder.com:8443/v3/members/_suggest/
341341
@groupMemberSearchApiUrl@=https://cockpit.cloud.topcoder.com/direct/group/member?handle=
342-
@groupMemberApiUrl@=http://tc-api.cloud.topcoder.com:8080/v3/groups/%d/members
342+
@groupMemberApiUrl@=http://192.168.1.3:4000/v5/groups/%s/members
343343
@directChallengeServicesApiUrl@=http://api.topcoder-dev.com/v3/direct/challenges
344344
@authorizationUrl@=https://api.topcoder-dev.com/v3/authorizations
345-
@userGroupsApiEndpoint@=http://tc-api.cloud.topcoder.com:3000/api/v5/groups
345+
@userGroupsApiEndpoint@=http://192.168.1.3:4000/v5/groups
346346

347347
@aws_s3_bucket@=topcoder-dev-submissions
348348
@aws_s3_access_key@=
349349
@aws_s3_secret_key@=
350350

351351
@trialBillingId@ =
352-
@defaultGroupIdForTrial@ =
352+
@defaultGroupIdForTrial@ =
353+
354+
# The Topcoder Connect Url to which the projects creation will redirect
355+
@TopcoderConnectUrl@=https://connect.topcoder-dev.com

token.properties.example

+4-1
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,7 @@
397397
@authorizationUrl@=http://api.topcoder-dev.com/v3/authorizations
398398
@userGroupsApiEndpoint@=http://172.18.0.1:8080/v3/groups
399399
@trialBillingId@ = 3
400-
@defaultGroupIdForTrial@ = 12347
400+
@defaultGroupIdForTrial@ = 12347
401+
402+
# The Topcoder Connect Url to which the projects creation will redirect
403+
@TopcoderConnectUrl@=https://connect.topcoder.com

0 commit comments

Comments
 (0)