File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
src/components/project/workflow Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ import {
12
12
BackToActive ,
13
13
ResolveParams ,
14
14
} from './transitions/dynamic-step' ;
15
- import { ImplicitlyNotifyTeamMembers } from './transitions/enhancers' ;
15
+ import {
16
+ ApprovalFromEarlyConversationsRequiresEngagements ,
17
+ ImplicitlyNotifyTeamMembers ,
18
+ } from './transitions/enhancers' ;
16
19
import { EmailDistro , FinancialApprovers } from './transitions/notifiers' ;
17
20
18
21
// This also controls the order shown in the UI.
@@ -37,6 +40,7 @@ export const ProjectWorkflow = defineWorkflow({
37
40
context : defineContext < ResolveParams > ,
38
41
transitionEnhancers : [
39
42
ImplicitlyNotifyTeamMembers , //
43
+ ApprovalFromEarlyConversationsRequiresEngagements ,
40
44
] ,
41
45
} ) ( {
42
46
// In Development
Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ export const IsMultiplication: Condition = {
23
23
} ,
24
24
} ;
25
25
26
+ export const HasEngagement : Condition = {
27
+ description : 'Has an engagement' ,
28
+ resolve ( { project } ) {
29
+ return {
30
+ status : project . engagementTotal > 0 ? 'ENABLED' : 'DISABLED' ,
31
+ disabledReason : `Create an engagement first` ,
32
+ } ;
33
+ } ,
34
+ } ;
35
+
26
36
export const RequireOngoingEngagementsToBeFinalizingCompletion : Condition = {
27
37
description :
28
38
'All engagements must be Finalizing Completion or in a terminal status' ,
Original file line number Diff line number Diff line change 1
1
import { TransitionEnhancer } from '../../../workflow/define-workflow' ;
2
2
import { ProjectStep as Step } from '../../dto' ;
3
+ import { HasEngagement } from './conditions' ;
3
4
import { ResolveParams } from './dynamic-step' ;
4
5
import { TeamMembers } from './notifiers' ;
5
6
@@ -9,3 +10,13 @@ export const ImplicitlyNotifyTeamMembers: Enhancer = (transition) => ({
9
10
...transition ,
10
11
notifiers : transition . notifiers . concat ( TeamMembers ) ,
11
12
} ) ;
13
+
14
+ export const ApprovalFromEarlyConversationsRequiresEngagements : Enhancer = (
15
+ transition ,
16
+ ) =>
17
+ transition . type === 'Approve' && transition . from ?. has ( 'EarlyConversations' )
18
+ ? {
19
+ ...transition ,
20
+ conditions : transition . conditions . concat ( HasEngagement ) ,
21
+ }
22
+ : transition ;
You can’t perform that action at this time.
0 commit comments