File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ import createUser from './users/createUser';
55
55
import getUserProfile from './users/getUserProfile' ;
56
56
import updateUserStatus from './users/updateUserStatus' ;
57
57
import getFileTemporaryUrl from './messages/getFileTemporaryUrl' ;
58
+ import getReadReceipts from './messages/getReadReceipts' ;
58
59
59
60
export {
60
61
fetchServerEmojiData ,
@@ -104,4 +105,5 @@ export {
104
105
getUserProfile ,
105
106
updateUserStatus ,
106
107
getFileTemporaryUrl ,
108
+ getReadReceipts ,
107
109
} ;
Original file line number Diff line number Diff line change
1
+ /* @flow strict-local */
2
+ import invariant from 'invariant' ;
3
+
4
+ import type { Auth , ApiResponseSuccess } from '../transportTypes' ;
5
+ import { apiGet } from '../apiFetch' ;
6
+ import type { UserId } from '../idTypes' ;
7
+
8
+ type ServerApiResponseReadReceipts = { |
9
+ ...$Exact < ApiResponseSuccess > ,
10
+ + user_ids : $ReadOnlyArray < UserId > ,
11
+ | } ;
12
+
13
+ /**
14
+ * See https://zulip.com/api/get-read-receipts
15
+ *
16
+ * Should only be called for servers with FL 137+.
17
+ */
18
+ // TODO(server-6.0): Stop mentioning a FL 137 condition.
19
+ export default async (
20
+ auth : Auth ,
21
+ args : { |
22
+ + message_id : number ,
23
+ | } ,
24
+
25
+ // TODO(#4659): Don't get this from callers.
26
+ zulipFeatureLevel : number ,
27
+ ) : Promise < $ReadOnlyArray < UserId >> => {
28
+ invariant ( zulipFeatureLevel >= 137 , 'api.getReadReceipts called for unsupporting server' ) ;
29
+
30
+ const { message_id } = args ;
31
+ const response : ServerApiResponseReadReceipts = await apiGet (
32
+ auth ,
33
+ `messages/${ message_id } /read_receipts` ,
34
+ ) ;
35
+
36
+ return response . user_ids ;
37
+ } ;
You can’t perform that action at this time.
0 commit comments