Skip to content

Commit b05991f

Browse files
committed
fix: don't activate project by coilot
1 parent 5986ae6 commit b05991f

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/config/permissions.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import {
7373
ROLE_PROJECT_MANAGER,
7474
ROLE_CONNECT_COPILOT,
7575
ROLE_CONNECT_COPILOT_MANAGER,
76+
MANAGER_ROLES,
7677
} from './constants'
7778
/* eslint-enable no-unused-vars */
7879

@@ -620,6 +621,19 @@ export const PERMISSIONS = {
620621
]
621622
},
622623

624+
EDIT_PROJECT_STATUS_TO_ACTIVE: {
625+
meta: {
626+
group: 'Project Details',
627+
title: 'Edit project status (to active)',
628+
},
629+
projectRoles: [
630+
...MANAGER_ROLES,
631+
],
632+
topcoderRoles: [
633+
...TOPCODER_ADMINS,
634+
]
635+
},
636+
623637
VIEW_PROJECT_SPECIAL_LINKS: {
624638
meta: {
625639
group: 'Project Details',

src/projects/actions/project.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import {
4747
PHASE_DIRTY,
4848
PHASE_DIRTY_UNDO,
4949
PROJECT_STATUS_IN_REVIEW,
50-
PHASE_STATUS_REVIEWED,
5150
PROJECT_STATUS_REVIEWED,
5251
PROJECT_STATUS_ACTIVE,
5352
EXPAND_PROJECT_PHASE,
@@ -74,6 +73,8 @@ import {
7473
updateProductTimeline
7574
} from './productsTimelines'
7675
import { delay } from '../../helpers/utils'
76+
import { hasPermission } from '../../helpers/permissions'
77+
import { PERMISSIONS } from '../../config/permissions'
7778

7879
/**
7980
* Expand phase and optionaly expand particular tab
@@ -505,24 +506,12 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
505506
}).then(() => {
506507
const project = state.projectState.project
507508

508-
// if one phase moved to REVIEWED status, make project IN_REVIEW too
509-
if (
510-
_.includes([PROJECT_STATUS_DRAFT], project.status) &&
511-
phase.status !== PHASE_STATUS_REVIEWED &&
512-
updatedProps.status === PHASE_STATUS_REVIEWED
513-
) {
514-
dispatch(
515-
updateProject(projectId, {
516-
status: PHASE_STATUS_REVIEWED
517-
}, true)
518-
)
519-
}
520-
521509
// if one phase moved to ACTIVE status, make project ACTIVE too
522510
if (
523511
_.includes([PROJECT_STATUS_DRAFT, PROJECT_STATUS_IN_REVIEW, PROJECT_STATUS_REVIEWED], project.status) &&
524512
phase.status !== PHASE_STATUS_ACTIVE &&
525-
updatedProps.status === PHASE_STATUS_ACTIVE
513+
updatedProps.status === PHASE_STATUS_ACTIVE &&
514+
hasPermission(PERMISSIONS.EDIT_PROJECT_STATUS_TO_ACTIVE)
526515
) {
527516
dispatch(
528517
updateProject(projectId, {

0 commit comments

Comments
 (0)