Skip to content

Commit 53aae53

Browse files
committed
api types: Fix PresenceEvent to not say it includes aggregated
The doc doesn't say that `client_name` can be "aggregated", and there isn't an `aggregated` key in the example in the doc. And for as long as I can remember, we've handled these events by not assuming they have `aggregated`, and recomputing it ourselves.
1 parent c40af51 commit 53aae53

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/api/eventTypes.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @flow strict-local
1111
*/
1212

13-
import type { SubsetProperties } from '../generics';
13+
import type { BoundedDiff, SubsetProperties } from '../generics';
1414
import { keyMirror } from '../utils/keyMirror';
1515
import type {
1616
CustomProfileField,
@@ -24,6 +24,7 @@ import type {
2424
UserPresence,
2525
UserStatusUpdate,
2626
UserSettings,
27+
ClientPresence,
2728
} from './modelTypes';
2829
import type { RealmDataForUpdate } from './realmDataTypes';
2930

@@ -135,12 +136,16 @@ export type SubmessageEvent = $ReadOnly<{|
135136
content: string,
136137
|}>;
137138

139+
/** https://zulip.com/api/get-events#presence */
138140
export type PresenceEvent = $ReadOnly<{|
139141
...EventCommon,
140142
type: typeof EventTypes.presence,
141143
email: string,
142144
server_timestamp: number,
143-
presence: UserPresence,
145+
146+
// Clients are asked to compute aggregated presence; the event doesn't
147+
// have it.
148+
presence: BoundedDiff<UserPresence, {| +aggregated: ClientPresence |}>,
144149
|}>;
145150

146151
/**

0 commit comments

Comments
 (0)