Skip to content

Commit 256ccbf

Browse files
Merge pull request #100 from topcoder-platform/feature/PLAT-2236
#PLAT-2236 Non self-service challenge should also get a forum
2 parents 5a7728c + 51bbbce commit 256ccbf

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/services/vanilla.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ async function createVanillaGroup (challenge) {
163163
throw new Error('Multiple discussions with type=\'challenge\' and provider=\'vanilla\' are not supported.')
164164
}
165165

166-
const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
167-
if(isSelfService && challenge.status !== constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
168-
logger.info(`The forums are created only for self-service challenges with the Active status.`)
169-
return
170-
}
171-
172166
const { body: project } = await topcoderApi.getProject(challenge.projectId)
173167
const allProjectRoles = _.values(constants.TOPCODER.PROJECT_ROLES)
174168
const members = _.filter(project.members, member => {
@@ -249,7 +243,7 @@ async function createVanillaGroup (challenge) {
249243
logger.info(`The '${challengeCategory.name}' category was created.`)
250244

251245
if (groupTemplate.categories) {
252-
const categories = _.filter(groupTemplate.categories, ['selfService', isSelfService])
246+
const categories = groupTemplate.categories
253247
for (const item of categories) {
254248
const urlCodeTemplate = _.template(item.urlcode)
255249
const { body: childCategory } = await vanillaClient.createCategory({
@@ -265,7 +259,7 @@ async function createVanillaGroup (challenge) {
265259
}
266260

267261
if (groupTemplate.discussions) {
268-
const groupDiscussions = _.filter(groupTemplate.discussions, ['selfService', isSelfService])
262+
const groupDiscussions = groupTemplate.discussions
269263
await createDiscussions(group, challenge, groupDiscussions, challengeCategory)
270264
}
271265

@@ -296,9 +290,8 @@ async function updateVanillaGroup (challenge) {
296290

297291
const { body: groups } = await vanillaClient.searchGroups(challenge.id)
298292
if (groups.length === 0) {
299-
const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
300-
// Create the forums for self-service challenges with the Active status
301-
if(isSelfService && challenge.status === constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
293+
// Create the forums for all challenges with the Active status
294+
if(challenge.status === constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
302295
await createVanillaGroup(challenge)
303296
return
304297
} else {

0 commit comments

Comments
 (0)