Skip to content

Issues-178 with permissisons #42

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 2 commits into from
Nov 15, 2020
Merged
Changes from all 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
20 changes: 4 additions & 16 deletions src/services/vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,9 @@ async function manageVanillaUser (data) {
userID: vanillaUser.userID
})
logger.info(`The user '${vanillaUser.name}' was added to the group '${group.name}'`)
// if User is added => watch the category
for (const category of categories) {
await vanillaClient.watchCategory(category.categoryID, vanillaUser.userID, { watched: true })
logger.info(`The user ${vanillaUser.name} watches categoryID=${category.categoryID} associated with challenge ${challengeId}`)
await vanillaClient.followCategory(category.categoryID, { followed: true, userID: vanillaUser.userID })
logger.info(`The user ${vanillaUser.name} follows categoryID=${category.categoryID} associated with challenge ${challengeId}`)
}
break
}
case constants.USER_ACTIONS.KICK: {
// if User is removed => don't watch the category
for (const category of categories) {
await vanillaClient.watchCategory(category.categoryID, vanillaUser.userID, { watched: false })
logger.info(`The user ${vanillaUser.name} stopped watching categoryID=${category.categoryID} associated with challenge ${challengeId}`)
await vanillaClient.followCategory(category.categoryID, { followed: false, userID: vanillaUser.userID })
logger.info(`The user ${vanillaUser.name} unfollows categoryID=${category.categoryID} associated with challenge ${challengeId}`)
}
await vanillaClient.removeUserFromGroup(group.groupID, vanillaUser.userID)
logger.info(`The user '${vanillaUser.name}' was removed from the group '${group.name}'`)
break
Expand Down Expand Up @@ -247,7 +233,8 @@ async function createVanillaGroup (challenge) {
name: challenge.name,
urlcode: `${challenge.id}`,
parentCategoryID: parentCategory[0].categoryID,
displayAs: groupTemplate.categories ? constants.VANILLA.CATEGORY_DISPLAY_STYLE.CATEGORIES : constants.VANILLA.CATEGORY_DISPLAY_STYLE.DISCUSSIONS
displayAs: groupTemplate.categories ? constants.VANILLA.CATEGORY_DISPLAY_STYLE.CATEGORIES : constants.VANILLA.CATEGORY_DISPLAY_STYLE.DISCUSSIONS,
groupID: group.groupID
})

logger.info(`The '${challengeCategory.name}' category was created`)
Expand All @@ -258,7 +245,8 @@ async function createVanillaGroup (challenge) {
const { body: childCategory } = await vanillaClient.createCategory({
name: item.name,
urlcode: `${urlCodeTemplate({ challenge })}`,
parentCategoryID: challengeCategory.categoryID
parentCategoryID: challengeCategory.categoryID,
groupID: group.groupID
})
logger.info(`The '${item.name}' category was created`)
await createDiscussions(group, challenge, item.discussions, childCategory)
Expand Down