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';
5555import getUserProfile from './users/getUserProfile' ;
5656import updateUserStatus from './users/updateUserStatus' ;
5757import getFileTemporaryUrl from './messages/getFileTemporaryUrl' ;
58+ import getReadReceipts from './messages/getReadReceipts' ;
5859
5960export {
6061 fetchServerEmojiData ,
@@ -104,4 +105,5 @@ export {
104105 getUserProfile ,
105106 updateUserStatus ,
106107 getFileTemporaryUrl ,
108+ getReadReceipts ,
107109} ;
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