File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
src/components/dialogs/nuxs Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {InitialVerificationAnnouncement} from '#/components/dialogs/nuxs/Initial
16
16
* NUXs
17
17
*/
18
18
import { isSnoozed , snooze , unsnooze } from '#/components/dialogs/nuxs/snoozing'
19
+ import { isDaysOld } from '#/components/dialogs/nuxs/utils'
19
20
20
21
type Context = {
21
22
activeNux : Nux | undefined
@@ -33,7 +34,9 @@ const queuedNuxs: {
33
34
} [ ] = [
34
35
{
35
36
id : Nux . InitialVerificationAnnouncement ,
36
- enabled : ( ) => true ,
37
+ enabled : ( { currentProfile} ) => {
38
+ return isDaysOld ( 2 , currentProfile . createdAt )
39
+ } ,
37
40
} ,
38
41
]
39
42
Original file line number Diff line number Diff line change
1
+ const ONE_DAY = 1000 * 60 * 60 * 24
2
+
3
+ export function isDaysOld ( days : number , createdAt ?: string ) {
4
+ /*
5
+ * Should never happen because we gate NUXs to only accounts with a valid
6
+ * profile and a `createdAt` (see `nuxs/index.tsx`). But if it ever did, the
7
+ * account is either old enough to be pre-onboarding, or some failure happened
8
+ * during account creation. Fail closed. - esb
9
+ */
10
+ if ( ! createdAt ) return false
11
+
12
+ const now = Date . now ( )
13
+ const then = new Date ( createdAt ) . getTime ( )
14
+ const isOldEnough = then + ONE_DAY * days < now
15
+
16
+ if ( isOldEnough ) return true
17
+ return false
18
+ }
You can’t perform that action at this time.
0 commit comments