@@ -48,7 +48,7 @@ type AnalyticsThreadPermissions = {
4848} ;
4949
5050type AnalyticsUser = {
51- createdAt : string ,
51+ createdAt : ? string ,
5252 twitterAuthed : boolean ,
5353 fbAuthed : boolean ,
5454 githubAuthed : boolean ,
@@ -74,11 +74,12 @@ type AnalyticsMessage = {
7474} ;
7575
7676export const analyticsReaction = ( reaction : ?DBReaction ) : AnalyticsReaction => {
77- if ( ! reaction )
77+ if ( ! reaction ) {
7878 return {
7979 id : null ,
8080 type : null ,
8181 } ;
82+ }
8283
8384 return {
8485 id : reaction . id ,
@@ -89,11 +90,12 @@ export const analyticsReaction = (reaction: ?DBReaction): AnalyticsReaction => {
8990export const analyticsThreadReaction = (
9091 reaction : ?DBThreadReaction
9192) : AnalyticsThreadReaction => {
92- if ( ! reaction )
93+ if ( ! reaction ) {
9394 return {
9495 id : null ,
9596 type : null ,
9697 } ;
98+ }
9799
98100 return {
99101 id : reaction . id ,
@@ -102,12 +104,13 @@ export const analyticsThreadReaction = (
102104} ;
103105
104106export const analyticsMessage = ( message : ?DBMessage ) : AnalyticsMessage => {
105- if ( ! message )
107+ if ( ! message ) {
106108 return {
107109 id : null ,
108110 threadType : null ,
109111 parentId : null ,
110112 } ;
113+ }
111114
112115 return {
113116 id : message . id ,
@@ -117,14 +120,15 @@ export const analyticsMessage = (message: ?DBMessage): AnalyticsMessage => {
117120} ;
118121
119122export const analyticsChannel = ( channel : ?DBChannel ) : AnalyticsChannel => {
120- if ( ! channel )
123+ if ( ! channel ) {
121124 return {
122125 id : null ,
123126 name : null ,
124127 slug : null ,
125128 isPrivate : null ,
126129 isArchived : null ,
127130 } ;
131+ }
128132
129133 return {
130134 id : channel . id ,
@@ -151,13 +155,14 @@ export const analyticsChannelPermissions = (
151155export const analyticsCommunity = (
152156 community : DBCommunity
153157) : AnalyticsCommunity => {
154- if ( ! community )
158+ if ( ! community ) {
155159 return {
156160 id : null ,
157161 name : null ,
158162 slug : null ,
159163 isPrivate : false ,
160164 } ;
165+ }
161166
162167 return {
163168 id : community . id ,
@@ -170,11 +175,12 @@ export const analyticsCommunity = (
170175export const analyticsCommunityPermissions = (
171176 communityPermissions : DBUsersCommunities
172177) : AnalyticsCommunityPermissions => {
173- if ( ! communityPermissions )
178+ if ( ! communityPermissions ) {
174179 return {
175180 roles : [ ] ,
176181 reputation : 0 ,
177182 } ;
183+ }
178184
179185 return {
180186 roles : getTruthyValuesFromObject ( communityPermissions ) ,
@@ -183,12 +189,13 @@ export const analyticsCommunityPermissions = (
183189} ;
184190
185191export const analyticsThread = ( thread : ?DBThread ) : AnalyticsThread => {
186- if ( ! thread )
192+ if ( ! thread ) {
187193 return {
188194 id : null ,
189195 isLocked : null ,
190196 isWatercooler : null ,
191197 } ;
198+ }
192199
193200 return {
194201 id : thread . id ,
@@ -214,6 +221,17 @@ export const analyticsThreadPermissions = (
214221} ;
215222
216223export const analyticsUser = ( user : DBUser ) : AnalyticsUser => {
224+ if ( ! user ) {
225+ return {
226+ createdAt : null ,
227+ twitterAuthed : false ,
228+ fbAuthed : false ,
229+ githubAuthed : false ,
230+ googleAuthed : false ,
231+ hasUsername : false ,
232+ lastSeen : null ,
233+ } ;
234+ }
217235 return {
218236 createdAt : user . createdAt ,
219237 twitterAuthed : user . providerId ? true : false ,
0 commit comments