@@ -135,7 +135,8 @@ export enum NotificationProblem {
135
135
* Data relevant to an account's push notifications, for support requests.
136
136
*
137
137
* Use jsonifyNotificationReport to get this into the form we want the user
138
- * to send the data in.
138
+ * to send the data in. One thing that does is strip away properties with
139
+ * value `undefined`.
139
140
*/
140
141
export type NotificationReport = { |
141
142
...Identity ,
@@ -151,8 +152,9 @@ export type NotificationReport = {|
151
152
/**
152
153
* Server data from an event queue, if any.
153
154
*
154
- * Pre-#5006, this will only be present for the active, logged-in
155
- * account, if it exists.
155
+ * Pre-#5006, this will be undefined except for the active, logged-in
156
+ * account, if it exists. For an active account that doesn't have server
157
+ * data yet, will be null.
156
158
*/
157
159
// TODO(#5006): When we store server data for multiple accounts, include
158
160
// this for all accounts that have server data.
@@ -163,7 +165,7 @@ export type NotificationReport = {|
163
165
+ offlineNotification : boolean ,
164
166
+ onlineNotification : boolean ,
165
167
+ streamNotification : boolean ,
166
- | } | null ,
168
+ | } | null | void ,
167
169
| } ;
168
170
169
171
/**
@@ -198,21 +200,22 @@ export function useNotificationReportsByIdentityKey(): Map<string, NotificationR
198
200
const identity = identityOfAccount ( account ) ;
199
201
const isLoggedIn = apiKey !== '' ;
200
202
201
- let serverData = null ;
203
+ let serverData = undefined ;
202
204
if (
203
205
activeAccountState
204
206
&& keyOfIdentity ( identityOfAccount ( getAccount ( activeAccountState ) ) )
205
207
=== keyOfIdentity ( identityOfAccount ( account ) )
206
- && getHaveServerData ( activeAccountState )
207
208
) {
208
- serverData = {
209
- zulipVersion : getServerVersion ( activeAccountState ) ,
210
- zulipFeatureLevel : getZulipFeatureLevel ( activeAccountState ) ,
211
- pushNotificationsEnabled : getRealm ( activeAccountState ) . pushNotificationsEnabled ,
212
- offlineNotification : getSettings ( activeAccountState ) . offlineNotification ,
213
- onlineNotification : getSettings ( activeAccountState ) . onlineNotification ,
214
- streamNotification : getSettings ( activeAccountState ) . streamNotification ,
215
- } ;
209
+ serverData = getHaveServerData ( activeAccountState )
210
+ ? {
211
+ zulipVersion : getServerVersion ( activeAccountState ) ,
212
+ zulipFeatureLevel : getZulipFeatureLevel ( activeAccountState ) ,
213
+ pushNotificationsEnabled : getRealm ( activeAccountState ) . pushNotificationsEnabled ,
214
+ offlineNotification : getSettings ( activeAccountState ) . offlineNotification ,
215
+ onlineNotification : getSettings ( activeAccountState ) . onlineNotification ,
216
+ streamNotification : getSettings ( activeAccountState ) . streamNotification ,
217
+ }
218
+ : null ;
216
219
}
217
220
218
221
const problems = [ ] ;
0 commit comments