@@ -46,8 +46,6 @@ interface InternalUserOnboardingTask extends UserOnboardingTask {
46
46
completed : ( ctx : UserOnboardingContext ) => boolean ;
47
47
}
48
48
49
- const hasOpenDMs = ( ctx : UserOnboardingContext ) => Boolean ( Object . entries ( ctx . dmRooms ) . length ) ;
50
-
51
49
const onClickStartDm = ( ev : ButtonEvent ) => {
52
50
PosthogTrackers . trackInteraction ( "WebUserOnboardingTaskSendDm" , ev ) ;
53
51
defaultDispatcher . dispatch ( { action : 'view_create_chat' } ) ;
@@ -64,7 +62,7 @@ const tasks: InternalUserOnboardingTask[] = [
64
62
id : "find-friends" ,
65
63
title : _t ( "Find and invite your friends" ) ,
66
64
description : _t ( "It’s what you’re here for, so lets get to it" ) ,
67
- completed : hasOpenDMs ,
65
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasDmRooms ,
68
66
relevant : [ UseCase . PersonalMessaging , UseCase . Skip ] ,
69
67
action : {
70
68
label : _t ( "Find friends" ) ,
@@ -75,7 +73,7 @@ const tasks: InternalUserOnboardingTask[] = [
75
73
id : "find-coworkers" ,
76
74
title : _t ( "Find and invite your co-workers" ) ,
77
75
description : _t ( "Get stuff done by finding your teammates" ) ,
78
- completed : hasOpenDMs ,
76
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasDmRooms ,
79
77
relevant : [ UseCase . WorkMessaging ] ,
80
78
action : {
81
79
label : _t ( "Find people" ) ,
@@ -86,7 +84,7 @@ const tasks: InternalUserOnboardingTask[] = [
86
84
id : "find-community-members" ,
87
85
title : _t ( "Find and invite your community members" ) ,
88
86
description : _t ( "Get stuff done by finding your teammates" ) ,
89
- completed : hasOpenDMs ,
87
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasDmRooms ,
90
88
relevant : [ UseCase . CommunityMessaging ] ,
91
89
action : {
92
90
label : _t ( "Find people" ) ,
@@ -97,9 +95,7 @@ const tasks: InternalUserOnboardingTask[] = [
97
95
id : "download-apps" ,
98
96
title : _t ( "Download Element" ) ,
99
97
description : _t ( "Don’t miss a thing by taking Element with you" ) ,
100
- completed : ( ctx : UserOnboardingContext ) => {
101
- return Boolean ( ctx . devices . filter ( it => it . device_id !== ctx . myDevice ) . length ) ;
102
- } ,
98
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasDevices ,
103
99
action : {
104
100
label : _t ( "Download apps" ) ,
105
101
onClick : ( ev : ButtonEvent ) => {
@@ -112,7 +108,7 @@ const tasks: InternalUserOnboardingTask[] = [
112
108
id : "setup-profile" ,
113
109
title : _t ( "Set up your profile" ) ,
114
110
description : _t ( "Make sure people know it’s really you" ) ,
115
- completed : ( info : UserOnboardingContext ) => Boolean ( info . avatar ) ,
111
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasAvatar ,
116
112
action : {
117
113
label : _t ( "Your profile" ) ,
118
114
onClick : ( ev : ButtonEvent ) => {
@@ -128,7 +124,7 @@ const tasks: InternalUserOnboardingTask[] = [
128
124
id : "permission-notifications" ,
129
125
title : _t ( "Turn on notifications" ) ,
130
126
description : _t ( "Don’t miss a reply or important message" ) ,
131
- completed : ( ) => Notifier . isPossible ( ) ,
127
+ completed : ( ctx : UserOnboardingContext ) => ctx . hasNotificationsEnabled ,
132
128
action : {
133
129
label : _t ( "Enable notifications" ) ,
134
130
onClick : ( ev : ButtonEvent ) => {
0 commit comments