File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/routes/copilotOpportunity Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,11 @@ module.exports = [
33
33
. then ( ( copilotOpportunity ) => {
34
34
const plainOpportunity = copilotOpportunity . get ( { plain : true } ) ;
35
35
req . log . info ( "authUser" , req . authUser ) ;
36
- const memberIds = plainOpportunity . project . members . map ( ( member ) => member . userId ) ;
37
- const canApplyAsCopilot = ! memberIds . includes ( req . authUser . userId )
36
+ const memberIds = plainOpportunity . project . members && plainOpportunity . project . members . map ( ( member ) => member . userId ) ;
37
+ let canApplyAsCopilot = false ;
38
+ if ( req . authUser ) {
39
+ canApplyAsCopilot = ! memberIds . includes ( req . authUser . userId )
40
+ }
38
41
// This shouldn't be exposed to the clientside
39
42
delete plainOpportunity . project . members ;
40
43
const formattedOpportunity = Object . assign ( {
You can’t perform that action at this time.
0 commit comments