@@ -6,7 +6,7 @@ import util from '../../util';
6
6
7
7
module . exports = [
8
8
( req , res , next ) => {
9
- const canAccessAllApplications = util . hasRoles ( req , ADMIN_ROLES ) || util . hasProjectManagerRole ( req ) ;
9
+ const isAdminOrPM = util . hasRoles ( req , ADMIN_ROLES ) || util . hasProjectManagerRole ( req ) ;
10
10
const opportunityId = _ . parseInt ( req . params . id ) ;
11
11
12
12
let sort = req . query . sort ? decodeURIComponent ( req . query . sort ) : 'createdAt desc' ;
@@ -50,7 +50,7 @@ module.exports = [
50
50
req . log . debug ( `Fetched existing active members ${ JSON . stringify ( members ) } ` ) ;
51
51
req . log . debug ( `Applications ${ JSON . stringify ( copilotApplications ) } ` ) ;
52
52
const enrichedApplications = copilotApplications . map ( ( application ) => {
53
- const m = members . find ( member => member . userId === application . userId ) ;
53
+ const member = members . find ( memberItem => memberItem . userId === application . userId ) ;
54
54
55
55
// Using spread operator fails in lint check
56
56
// While Object.assign fails silently during run time
@@ -70,16 +70,16 @@ module.exports = [
70
70
copilotOpportunity : application . copilotOpportunity ,
71
71
} ;
72
72
73
- if ( m ) {
74
- enriched . existingMembership = m ;
73
+ if ( member ) {
74
+ enriched . existingMembership = member ;
75
75
}
76
76
77
77
req . log . debug ( `Existing member to application ${ JSON . stringify ( enriched ) } ` ) ;
78
78
79
79
return enriched ;
80
80
} ) ;
81
81
82
- const response = canAccessAllApplications
82
+ const response = isAdminOrPM
83
83
? enrichedApplications
84
84
: enrichedApplications . map ( app => ( {
85
85
userId : app . userId ,
0 commit comments