Skip to content

Commit e6e6397

Browse files
committed
Issues-112: managers are added to a group
1 parent 9e6cd2d commit e6e6397

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ module.exports = {
4040
KICK: 'kick'
4141
},
4242
TOPCODER: {
43-
ROLE_COPILOT: 'copilot'
43+
ROLE_COPILOT: 'copilot',
44+
ROLE_MANAGER: 'manager'
4445
},
4546
VANILLA: {
4647
CHALLENGES_FORUM: 'Challenges Forums',

src/services/vanilla.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ async function createVanillaGroup (challenge) {
181181
}
182182

183183
const { body: project } = await topcoderApi.getProject(challenge.projectId)
184-
const copilots = _.filter(project.members, { role: constants.TOPCODER.ROLE_COPILOT })
184+
const members = _.filter(project.members, member => {
185+
return member.role === constants.TOPCODER.ROLE_COPILOT || member.role === constants.TOPCODER.ROLE_MANAGER
186+
})
187+
188+
logger.info('Members: ' + JSON.stringify(members))
189+
185190
const challengesForums = _.filter(template.categories, ['name', constants.VANILLA.CHALLENGES_FORUM])
186191
if (!challengesForums) {
187192
throw new Error(`The '${constants.VANILLA.CHALLENGES_FORUM}' category wasn't found in the template json file`)
@@ -265,8 +270,8 @@ async function createVanillaGroup (challenge) {
265270
await createDiscussions(group, challenge, groupTemplate.discussions, challengeCategory)
266271
}
267272

268-
for (const copilot of copilots) {
269-
await manageVanillaUser({ challengeId: challenge.id, action: constants.USER_ACTIONS.INVITE, handle: copilot.handle })
273+
for (const member of members) {
274+
await manageVanillaUser({ challengeId: challenge.id, action: constants.USER_ACTIONS.INVITE, handle: member.handle })
270275
}
271276

272277
challengeDetailsDiscussion.url = `${challengeCategory.url}`

0 commit comments

Comments
 (0)