@@ -44,7 +44,10 @@ module.exports = {
4444 if ( user . hasValidUser ( 'AppUser' ) && applicationId !== user . getAppId ( ) ) {
4545 throw new UserInputError ( 'The provided application context does not match the app for the user.' ) ;
4646 }
47- return applicationService . request ( 'loadContext' , { applicationId, email, ipAddress } ) ;
47+ const context = await applicationService . request ( 'loadContext' , { applicationId, email, ipAddress } ) ;
48+ // set last seen (do not await)
49+ if ( context . user ) applicationService . request ( 'user.setLastSeen' , { id : context . user . _id } ) ;
50+ return context ;
4851 } ,
4952
5053 checkContentAccess : async ( _ , { input } , { user, app, req } ) => {
@@ -78,13 +81,15 @@ module.exports = {
7881 /**
7982 *
8083 */
81- activeAppUser : ( _ , args , { user } ) => {
84+ activeAppUser : async ( _ , args , { user } ) => {
8285 const email = user . get ( 'email' ) ;
8386 const applicationId = user . getAppId ( ) ;
84- return applicationService . request ( 'user.findByEmail' , {
87+ const userDoc = await applicationService . request ( 'user.findByEmail' , {
8588 applicationId,
8689 email,
8790 } ) ;
91+ applicationService . request ( 'user.setLastSeen' , { id : userDoc . _id } ) ;
92+ return userDoc ;
8893 } ,
8994
9095 /**
0 commit comments