From 79d951575fe6526027778c7b16e3f0d96f073dbe Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 15 Nov 2020 21:37:56 +0300 Subject: [PATCH 1/2] Issues-178 with permisisons --- src/services/vanilla.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/services/vanilla.js b/src/services/vanilla.js index 251c940..f33059e 100644 --- a/src/services/vanilla.js +++ b/src/services/vanilla.js @@ -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 @@ -206,7 +192,7 @@ async function createVanillaGroup (challenge) { if (challengeDetailsDiscussion.type === 'challenge' && challengeDetailsDiscussion.provider === 'vanilla') { if (challengeDetailsDiscussion.url && challengeDetailsDiscussion.url !== '') { logger.info(`The url has been set for the ${challengeDetailsDiscussion.name} discussion with type='challenge' and provider='vanilla'`) - continue + // continue } const { body: groups } = await vanillaClient.searchGroups(challenge.id) @@ -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`) @@ -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) From d30e06e40f6da19c408d30744116b3c9d742fc7c Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 15 Nov 2020 21:39:14 +0300 Subject: [PATCH 2/2] Issues-178 with permisisons --- src/services/vanilla.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/vanilla.js b/src/services/vanilla.js index f33059e..2c49ed0 100644 --- a/src/services/vanilla.js +++ b/src/services/vanilla.js @@ -192,7 +192,7 @@ async function createVanillaGroup (challenge) { if (challengeDetailsDiscussion.type === 'challenge' && challengeDetailsDiscussion.provider === 'vanilla') { if (challengeDetailsDiscussion.url && challengeDetailsDiscussion.url !== '') { logger.info(`The url has been set for the ${challengeDetailsDiscussion.name} discussion with type='challenge' and provider='vanilla'`) - // continue + continue } const { body: groups } = await vanillaClient.searchGroups(challenge.id)