mirror of https://github.com/zulip/zulip.git
subscriber_api: Convert module to TypeScript.
This commit is contained in:
parent
6157d83d3a
commit
62a636068e
|
@ -240,7 +240,7 @@ EXEMPT_FILES = make_set(
|
||||||
"web/src/stream_settings_ui.js",
|
"web/src/stream_settings_ui.js",
|
||||||
"web/src/stream_ui_updates.js",
|
"web/src/stream_ui_updates.js",
|
||||||
"web/src/submessage.js",
|
"web/src/submessage.js",
|
||||||
"web/src/subscriber_api.js",
|
"web/src/subscriber_api.ts",
|
||||||
"web/src/timerender.ts",
|
"web/src/timerender.ts",
|
||||||
"web/src/tippyjs.ts",
|
"web/src/tippyjs.ts",
|
||||||
"web/src/todo_widget.js",
|
"web/src/todo_widget.js",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as channel from "./channel";
|
import * as channel from "./channel";
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
|
import type {StreamSubscription} from "./sub_store";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This module simply encapsulates our legacy API for subscribing
|
This module simply encapsulates our legacy API for subscribing
|
||||||
|
@ -8,7 +9,12 @@ import * as people from "./people";
|
||||||
nor how to JSON.stringify things, nor the URL scheme.
|
nor how to JSON.stringify things, nor the URL scheme.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function add_user_ids_to_stream(user_ids, sub, success, failure) {
|
export function add_user_ids_to_stream(
|
||||||
|
user_ids: number[],
|
||||||
|
sub: StreamSubscription,
|
||||||
|
success: () => void,
|
||||||
|
failure: (xhr: JQuery.jqXHR<unknown>) => void,
|
||||||
|
): JQuery.jqXHR<unknown> | undefined {
|
||||||
// TODO: use stream_id when backend supports it
|
// TODO: use stream_id when backend supports it
|
||||||
const stream_name = sub.name;
|
const stream_name = sub.name;
|
||||||
if (user_ids.length === 1 && people.is_my_user_id(Number(user_ids[0]))) {
|
if (user_ids.length === 1 && people.is_my_user_id(Number(user_ids[0]))) {
|
||||||
|
@ -32,7 +38,12 @@ export function add_user_ids_to_stream(user_ids, sub, success, failure) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function remove_user_id_from_stream(user_id, sub, success, failure) {
|
export function remove_user_id_from_stream(
|
||||||
|
user_id: number[],
|
||||||
|
sub: StreamSubscription,
|
||||||
|
success: () => void,
|
||||||
|
failure: (xhr: JQuery.jqXHR<unknown>) => void,
|
||||||
|
): JQuery.jqXHR<unknown> | undefined {
|
||||||
// TODO: use stream_id when backend supports it
|
// TODO: use stream_id when backend supports it
|
||||||
const stream_name = sub.name;
|
const stream_name = sub.name;
|
||||||
return channel.del({
|
return channel.del({
|
Loading…
Reference in New Issue