From 893d5b13186b34f966183b43e52a3f9da3561576 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sat, 5 Jun 2021 20:27:41 +0300 Subject: [PATCH] Issues-631: user registration --- src/constants.js | 1 + src/services/vanilla.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index bb74ed6..91537ea 100644 --- a/src/constants.js +++ b/src/constants.js @@ -60,6 +60,7 @@ module.exports = { } }, VANILLA: { + DEFAULT_MEMBER_ROLES: ['Vanilla Member'], CHALLENGES_FORUM: 'Challenges Forums', CATEGORY_DISPLAY_STYLE: { CATEGORIES: 'categories', diff --git a/src/services/vanilla.js b/src/services/vanilla.js index c4802ba..9993001 100644 --- a/src/services/vanilla.js +++ b/src/services/vanilla.js @@ -59,7 +59,10 @@ async function manageVanillaUser (data) { if (!vanillaUser) { logger.info(`The '${username}' user wasn't found in Vanilla`) - const defaultVanillaRoles = _.filter(allNewVanillaRoles, { type: 'member' }) + const defaultVanillaRoles = _.filter(allNewVanillaRoles, function (role) { + return role.type === 'member' && constants.VANILLA.DEFAULT_MEMBER_ROLES.includes(role.name) + }) + const defaultVanillaRoleIDs = _.map(defaultVanillaRoles, 'roleID') const userData = {