From b3e24803b6f35f9a7c05d13d5c8d5550f57f3ee0 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Fri, 18 Mar 2022 01:27:38 +0800 Subject: [PATCH 1/3] ci:deploying review role fix --- .circleci/config.yml | 2 +- src/common/helper.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d71b5cf1..39b93e5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ workflows: context : org-global filters: branches: - only: ['develop'] + only: ['issue_reviewer_role'] - "build-prod": context : org-global filters: diff --git a/src/common/helper.js b/src/common/helper.js index 912f47c2..031386bf 100755 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -453,6 +453,12 @@ function * checkCreateAccess (authUser, subEntity) { // Get phases and winner detail from challengeDetails const phases = challengeDetails.body.phases + // Check if the User is assigned as the reviewer for the contest + const reviewers = _.filter(currUserRoles, { role: 'Reviewer' }) + if (reviewers.length !== 0) { + throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a reviewer`) + } + // Check if the User is registered for the contest const submitters = _.filter(currUserRoles, { role: 'Submitter' }) if (submitters.length === 0) { From 1980a1b179cd8c25c0fc206008326105a83c3650 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 21 Mar 2022 20:35:19 +0800 Subject: [PATCH 2/3] iterative reviewer role --- src/common/helper.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/helper.js b/src/common/helper.js index 031386bf..554d6a2a 100755 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -459,6 +459,12 @@ function * checkCreateAccess (authUser, subEntity) { throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a reviewer`) } + // Check if the User is assigned as the iterative reviewer for the contest + const iterativeReviewers = _.filter(currUserRoles, { role: 'Iterative Reviewer' }) + if (iterativeReviewers.length !== 0) { + throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a iterative reviewer`) + } + // Check if the User is registered for the contest const submitters = _.filter(currUserRoles, { role: 'Submitter' }) if (submitters.length === 0) { From 7a8fb4a20bb4961a829a412ab7ec6e864689985e Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 21 Mar 2022 22:25:22 +0800 Subject: [PATCH 3/3] ci:reset --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 39b93e5e..d71b5cf1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ workflows: context : org-global filters: branches: - only: ['issue_reviewer_role'] + only: ['develop'] - "build-prod": context : org-global filters: