@@ -5,7 +5,7 @@ import { EVENT, BUS_API_EVENT, PROJECT_STATUS, PROJECT_PHASE_STATUS, PROJECT_MEM
5
5
from '../constants' ;
6
6
import { createEvent } from '../services/busApi' ;
7
7
import models from '../models' ;
8
- import { getTopcoderProjectMembers , isSSO } from '../util' ;
8
+ import util from '../util' ;
9
9
10
10
/**
11
11
* Map of project status and event name sent to bus api
@@ -367,7 +367,7 @@ module.exports = (app, logger) => {
367
367
userId : req . authUser . userId ,
368
368
initiatorUserId : req . authUser . userId ,
369
369
allowedUsers : created . status === PROJECT_PHASE_STATUS . DRAFT ?
370
- getTopcoderProjectMembers ( project . members ) : null ,
370
+ util . getTopcoderProjectMembers ( project . members ) : null ,
371
371
} , logger ) ;
372
372
return sendPlanReadyEventIfNeeded ( req , project , created ) ;
373
373
} ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
@@ -393,7 +393,7 @@ module.exports = (app, logger) => {
393
393
userId : req . authUser . userId ,
394
394
initiatorUserId : req . authUser . userId ,
395
395
allowedUsers : deleted . status === PROJECT_PHASE_STATUS . DRAFT ?
396
- getTopcoderProjectMembers ( project . members ) : null ,
396
+ util . getTopcoderProjectMembers ( project . members ) : null ,
397
397
} , logger ) ;
398
398
} ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
399
399
} ) ;
@@ -446,7 +446,7 @@ module.exports = (app, logger) => {
446
446
userId : req . authUser . userId ,
447
447
initiatorUserId : req . authUser . userId ,
448
448
allowedUsers : updated . status === PROJECT_PHASE_STATUS . DRAFT ?
449
- getTopcoderProjectMembers ( project . members ) : null ,
449
+ util . getTopcoderProjectMembers ( project . members ) : null ,
450
450
} , logger ) ) ;
451
451
events . forEach ( ( event ) => { eventsMap [ event ] = true ; } ) ;
452
452
}
@@ -493,7 +493,7 @@ module.exports = (app, logger) => {
493
493
userId : req . authUser . userId ,
494
494
initiatorUserId : req . authUser . userId ,
495
495
allowedUsers : updated . status === PROJECT_PHASE_STATUS . DRAFT ?
496
- getTopcoderProjectMembers ( project . members ) : null ,
496
+ util . getTopcoderProjectMembers ( project . members ) : null ,
497
497
} , logger ) ;
498
498
}
499
499
} ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
@@ -704,27 +704,36 @@ module.exports = (app, logger) => {
704
704
where : { id : projectId } ,
705
705
} )
706
706
. then ( ( project ) => {
707
+ logger . debug ( util . isSSO ) ;
707
708
if ( status === INVITE_STATUS . REQUESTED ) {
708
709
createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_REQUESTED , {
709
710
projectId,
710
711
userId,
711
712
email,
712
713
role,
713
714
initiatorUserId : req . authUser . userId ,
714
- isSSO : isSSO ( project ) ,
715
+ isSSO : util . isSSO ( project ) ,
715
716
} , logger ) ;
716
717
} else {
717
718
// send event to bus api
719
+ logger . debug ( JSON . stringify ( {
720
+ projectId,
721
+ userId,
722
+ email,
723
+ role,
724
+ initiatorUserId : req . authUser . userId ,
725
+ isSSO : util . isSSO ( project ) ,
726
+ } ) ) ;
718
727
createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_CREATED , {
719
728
projectId,
720
729
userId,
721
730
email,
722
731
role,
723
732
initiatorUserId : req . authUser . userId ,
724
- isSSO : isSSO ( project ) ,
733
+ isSSO : util . isSSO ( project ) ,
725
734
} , logger ) ;
726
735
}
727
- } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
736
+ } ) . catch ( err => logger . error ( err ) ) ; // eslint-disable-line no-unused-vars
728
737
} ) ;
729
738
730
739
app . on ( EVENT . ROUTING_KEY . PROJECT_MEMBER_INVITE_UPDATED , ( { req, userId, email, status, role, createdBy } ) => {
@@ -735,6 +744,7 @@ module.exports = (app, logger) => {
735
744
where : { id : projectId } ,
736
745
} )
737
746
. then ( ( project ) => {
747
+ logger . debug ( util . isSSO ) ;
738
748
if ( status === INVITE_STATUS . REQUEST_APPROVED ) {
739
749
// send event to bus api
740
750
createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_APPROVED , {
@@ -745,7 +755,7 @@ module.exports = (app, logger) => {
745
755
role,
746
756
status,
747
757
initiatorUserId : req . authUser . userId ,
748
- isSSO : isSSO ( project ) ,
758
+ isSSO : util . isSSO ( project ) ,
749
759
} , logger ) ;
750
760
} else if ( status === INVITE_STATUS . REQUEST_REJECTED ) {
751
761
// send event to bus api
@@ -757,7 +767,7 @@ module.exports = (app, logger) => {
757
767
role,
758
768
status,
759
769
initiatorUserId : req . authUser . userId ,
760
- isSSO : isSSO ( project ) ,
770
+ isSSO : util . isSSO ( project ) ,
761
771
} , logger ) ;
762
772
} else {
763
773
// send event to bus api
@@ -768,7 +778,7 @@ module.exports = (app, logger) => {
768
778
role,
769
779
status,
770
780
initiatorUserId : req . authUser . userId ,
771
- isSSO : isSSO ( project ) ,
781
+ isSSO : util . isSSO ( project ) ,
772
782
} , logger ) ;
773
783
}
774
784
} ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
0 commit comments