Skip to content

Commit 34f8a69

Browse files
authored
Merge pull request #50 from topcoder-platform/issues-372
Issues-372: removed 'follow group categories'
2 parents cc0d34c + fbc7bdd commit 34f8a69

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

src/services/vanilla.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async function manageVanillaUser (data) {
2222
const group = groups.length > 0 ? groups[0] : null
2323

2424
const watch = shouldWatchCategories(projectRole, challengeRoles)
25-
const follow = shouldFollowCategories(projectRole, challengeRoles)
2625

2726
if (!group) {
2827
throw new Error('The group wasn\'t not found by challengeID')
@@ -96,10 +95,9 @@ async function manageVanillaUser (data) {
9695
case constants.USER_ACTIONS.INVITE: {
9796
await vanillaClient.addUserToGroup(group.groupID, {
9897
userID: vanillaUser.userID,
99-
watch: watch,
100-
follow: follow
98+
watch: watch
10199
})
102-
logger.info(`User [UserID=${vanillaUser.userID}, Name=${vanillaUser.name} was added to Group [GroupID=${group.groupID}, Name=${group.name}, Watch=${watch}, Follow=${follow}]`)
100+
logger.info(`User [UserID=${vanillaUser.userID}, Name=${vanillaUser.name} was added to Group [GroupID=${group.groupID}, Name=${group.name}, Watch=${watch}]`)
103101
break
104102
}
105103
case constants.USER_ACTIONS.KICK: {
@@ -342,27 +340,6 @@ function shouldWatchCategories (projectRole, challengeRoles) {
342340
)
343341
}
344342

345-
/**
346-
* Auto-follow categories
347-
* @param projectRole string
348-
* @param challengeRoles array
349-
* @returns {boolean}
350-
*/
351-
function shouldFollowCategories (projectRole, challengeRoles) {
352-
// New user
353-
if (!projectRole && _.isEmpty(challengeRoles)) {
354-
return true
355-
}
356-
357-
// Project Copilots or Managers / Challenge Copilots, Managers and Submitters
358-
return projectRole === constants.TOPCODER.PROJECT_ROLES.COPILOT ||
359-
projectRole === constants.TOPCODER.PROJECT_ROLES.MANAGER ||
360-
(_.isArray(challengeRoles) && (_.includes(challengeRoles, constants.TOPCODER.CHALLENGE_ROLES.COPILOT) ||
361-
_.includes(challengeRoles, constants.TOPCODER.CHALLENGE_ROLES.MANAGER) ||
362-
_.includes(challengeRoles, constants.TOPCODER.CHALLENGE_ROLES.SUBMITTER))
363-
)
364-
}
365-
366343
module.exports = {
367344
manageVanillaUser,
368345
createVanillaGroup,

src/utils/vanilla-client.util.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ function getVanillaClient () {
2424
throw err
2525
})
2626
},
27-
followCategory: (categoryId, data) => {
28-
return request.put(`${config.VANILLA.API_URL}/categories/${categoryId}/follow`)
29-
.query({ access_token: config.VANILLA.ADMIN_ACCESS_TOKEN })
30-
.send(data)
31-
},
3227
updateCategory: (categoryId, data) => {
3328
return request.patch(`${config.VANILLA.API_URL}/categories/${categoryId}`)
3429
.query({ access_token: config.VANILLA.ADMIN_ACCESS_TOKEN })

0 commit comments

Comments
 (0)