Skip to content

#PLAT-2236 Non self-service challenge should also get a forum #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 27, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/services/vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ async function createVanillaGroup (challenge) {
throw new Error('Multiple discussions with type=\'challenge\' and provider=\'vanilla\' are not supported.')
}

const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
if(isSelfService && challenge.status !== constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
logger.info(`The forums are created only for self-service challenges with the Active status.`)
return
}

const { body: project } = await topcoderApi.getProject(challenge.projectId)
const allProjectRoles = _.values(constants.TOPCODER.PROJECT_ROLES)
const members = _.filter(project.members, member => {
Expand Down Expand Up @@ -248,7 +242,7 @@ async function createVanillaGroup (challenge) {
logger.info(`The '${challengeCategory.name}' category was created.`)

if (groupTemplate.categories) {
const categories = _.filter(groupTemplate.categories, ['selfService', isSelfService])
const categories = groupTemplate.categories;
for (const item of categories) {
const urlCodeTemplate = _.template(item.urlcode)
const { body: childCategory } = await vanillaClient.createCategory({
Expand All @@ -264,7 +258,7 @@ async function createVanillaGroup (challenge) {
}

if (groupTemplate.discussions) {
const groupDiscussions = _.filter(groupTemplate.discussions, ['selfService', isSelfService])
const groupDiscussions = groupTemplate.discussions;
await createDiscussions(group, challenge, groupDiscussions, challengeCategory)
}

Expand Down Expand Up @@ -295,9 +289,9 @@ async function updateVanillaGroup (challenge) {

const { body: groups } = await vanillaClient.searchGroups(challenge.id)
if (groups.length === 0) {
const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
//const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this one as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// Create the forums for self-service challenges with the Active status
if(isSelfService && challenge.status === constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
if(challenge.status === constants.TOPCODER.CHALLENGE_STATUSES.ACTIVE) {
await createVanillaGroup(challenge)
return
} else {
Expand Down