@@ -3,7 +3,15 @@ import type { IntlShape } from 'react-intl';
3
3
import type { DangerouslyImpreciseStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet' ;
4
4
5
5
import type { SubsetProperties } from './generics' ;
6
- import type { Auth , Topic , Message , ReactionType , UserId } from './api/apiTypes' ;
6
+ import type {
7
+ Auth ,
8
+ Topic ,
9
+ Message ,
10
+ PmMessage ,
11
+ StreamMessage ,
12
+ ReactionType ,
13
+ UserId ,
14
+ } from './api/apiTypes' ;
7
15
import type { ZulipVersion } from './utils/zulipVersion' ;
8
16
import type { PmKeyUsers } from './utils/recipient' ;
9
17
@@ -140,28 +148,7 @@ export type TopicExtended = {|
140
148
unreadCount : number ,
141
149
| } ;
142
150
143
- /**
144
- * A message we're in the process of sending.
145
- *
146
- * We use these objects for two purposes:
147
- *
148
- * (a) They make up the queue of messages the user has asked us to send, and
149
- * which we'll retry sending if initial attempts fail. See
150
- * `trySendMessages`.
151
- *
152
- * (b) We show them immediately in the message list, even before we've
153
- * successfully gotten them to the server (but with an activity
154
- * indicator to show we're still working on them.)
155
- *
156
- * Even after (a) is complete for a given message, we still need the
157
- * `Outbox` object for the sake of (b), until we hear an `EVENT_NEW_MESSAGE`
158
- * event from the server that lets us replace it with the corresponding
159
- * `Message` object.
160
- *
161
- * This type most often appears in the union `Message | Outbox`, and so its
162
- * properties are deliberately similar to those of `Message`.
163
- */
164
- export type Outbox = $ReadOnly < { |
151
+ export type OutboxBase = $ReadOnly < { |
165
152
/** Used for distinguishing from a `Message` object. */
166
153
isOutbox : true ,
167
154
@@ -180,6 +167,8 @@ export type Outbox = $ReadOnly<{|
180
167
181
168
/* eslint-disable flowtype/generic-spacing */
182
169
...SubsetProperties <
170
+ // Could use `MessageBase` here, but Flow would complain anyway if
171
+ // we tried to put something that's not in `MessageBase` below.
183
172
Message ,
184
173
{ |
185
174
avatar_url : mixed ,
@@ -197,6 +186,41 @@ export type Outbox = $ReadOnly<{|
197
186
> ,
198
187
| } > ;
199
188
189
+ export type PmOutbox = { |
190
+ ...OutboxBase ,
191
+
192
+ ...SubsetProperties < PmMessage , { || } > ,
193
+ | } ;
194
+
195
+ export type StreamOutbox = { |
196
+ ...OutboxBase ,
197
+
198
+ ...SubsetProperties < StreamMessage , { || } > ,
199
+ | } ;
200
+
201
+ /**
202
+ * A message we're in the process of sending.
203
+ *
204
+ * We use these objects for two purposes:
205
+ *
206
+ * (a) They make up the queue of messages the user has asked us to send, and
207
+ * which we'll retry sending if initial attempts fail. See
208
+ * `trySendMessages`.
209
+ *
210
+ * (b) We show them immediately in the message list, even before we've
211
+ * successfully gotten them to the server (but with an activity
212
+ * indicator to show we're still working on them.)
213
+ *
214
+ * Even after (a) is complete for a given message, we still need the
215
+ * `Outbox` object for the sake of (b), until we hear an `EVENT_NEW_MESSAGE`
216
+ * event from the server that lets us replace it with the corresponding
217
+ * `Message` object.
218
+ *
219
+ * This type most often appears in the union `Message | Outbox`, and so its
220
+ * properties are deliberately similar to those of `Message`.
221
+ */
222
+ export type Outbox = PmOutbox | StreamOutbox ;
223
+
200
224
/**
201
225
* MessageLike: Imprecise alternative to `Message | Outbox`.
202
226
*
0 commit comments