File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export async function GET(req: Request) {
4949 : null ;
5050
5151 const human = await db ( ) . human ( user . data . id ) ;
52- if ( ! human )
52+ if ( ! human ) {
5353 await db ( ) . createUser ( {
5454 githubId : user . data . id ,
5555 username : user . data . login ,
@@ -62,11 +62,13 @@ export async function GET(req: Request) {
6262 bio : user . data . bio ,
6363 location : user . data . location ,
6464 } ) ;
65+ }
6566
6667 await welcome ( {
6768 githubId : user . data . id ,
6869 email : primaryEmail ,
6970 name : user . data . name ,
71+ createdAt : human ?. createdAt as Date ,
7072 } ) ;
7173
7274 const cookieStore = await cookies ( ) ;
Original file line number Diff line number Diff line change @@ -55,9 +55,12 @@ const SUBJECTS = [
5555 'Congrats — you’ve leveled up in pettiness 🎖️' ,
5656] ;
5757
58- export async function welcome ( user : Pick < User , 'githubId' | 'email' | 'name' > ) {
58+ export async function welcome (
59+ user : Pick < User , 'createdAt' | 'githubId' | 'email' | 'name' >
60+ ) {
5961 const human = await db ( ) . human ( user . githubId ) ;
60- if ( human ) return ;
62+ if ( new Date ( human ?. createdAt as Date ) . getDate ( ) !== new Date ( ) . getDate ( ) )
63+ return ;
6164
6265 const domain =
6366 NODE_ENV === 'production' ?
EMAIL_DOMAIN :
'[email protected] ' ;
You can’t perform that action at this time.
0 commit comments