@@ -27,7 +27,7 @@ module.exports = [
2727 ( req , res , next ) => {
2828 const projectId = _ . parseInt ( req . params . projectId ) ;
2929 const currentUserId = req . authUser . userId ;
30- const email = req . authUser . email ;
30+ const currentUserEmail = req . authUser . email ? req . authUser . email . toLowerCase ( ) : req . authUser . email ;
3131 const fields = req . query . fields ? req . query . fields . split ( ',' ) : null ;
3232
3333 const esSearchParam = {
@@ -64,7 +64,7 @@ module.exports = [
6464 esSearchParam . query . nested . query . filtered . filter . bool . must . push ( {
6565 bool : {
6666 should : [
67- { term : { 'invites.email' : email } } ,
67+ { term : { 'invites.email' : currentUserEmail } } ,
6868 { term : { 'invites.userId' : currentUserId } } ,
6969 ] ,
7070 minimum_number_should_match : 1 ,
@@ -90,7 +90,7 @@ module.exports = [
9090 }
9191 // get invitation only for user
9292 return models . ProjectMemberInvite . getPendingOrRequestedProjectInvitesForUser (
93- projectId , email , currentUserId ) ;
93+ projectId , currentUserEmail , currentUserId ) ;
9494 }
9595 req . log . debug ( 'project member found in ES' ) ;
9696 return data [ 0 ] . inner_hits . invites . hits . hits . map ( hit => hit . _source ) ; // eslint-disable-line no-underscore-dangle
0 commit comments