subscribers: Extract subscriber_api.

This simplifies some of our dependencies.

As an example, we really don't want compose.js
to depend on stream_subscribers_ui.js, since
the former doesn't use any actual UI code from
the latter.

We also rename the two functions here:

    invite_user_to_stream -> add_user_ids_to_stream
    remove_user_from_stream -> remove_user_id_from_stream

(The notion of "inviting" somebody to a stream is
somewhat misleading, since there is really no invitation
mechanism; you just add them.)

Apart from naming changes this is a verbatim code move.

Finally, we eliminate a little bit of test cruft--the
`override` helper already ensures that a function gets
called at least once during a test.
This commit is contained in:
Steve Howell
2022-02-21 14:28:56 +00:00
committed by Tim Abbott
parent 57398c9933
commit 65b51ae3bd
6 changed files with 54 additions and 38 deletions

View File

@@ -175,6 +175,7 @@ EXEMPT_FILES = make_set(
"static/js/stream_subscribers_ui.js",
"static/js/stream_ui_updates.js",
"static/js/submessage.js",
"static/js/subscriber_api.js",
"static/js/timerender.ts",
"static/js/tippyjs.js",
"static/js/todo_widget.js",