mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 04:43:58 +00:00
Ever since we started bundling the app with webpack, there’s been less and less overlap between our ‘static’ directory (files belonging to the frontend app) and Django’s interpretation of the ‘static’ directory (files served directly to the web). Split the app out to its own ‘web’ directory outside of ‘static’, and remove all the custom collectstatic --ignore rules. This makes it much clearer what’s actually being served to the web, and what’s being bundled by webpack. It also shrinks the release tarball by 3%. Signed-off-by: Anders Kaseorg <anders@zulip.com>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import * as channel from "./channel";
|
|
|
|
/*
|
|
This module simply encapsulates our legacy API for subscribing
|
|
or unsubscribing users from streams. Callers don't need to
|
|
know the strange names of "subscriptions" and "principals",
|
|
nor how to JSON.stringify things, nor the URL scheme.
|
|
*/
|
|
|
|
export function add_user_ids_to_stream(user_ids, sub, success, failure) {
|
|
// TODO: use stream_id when backend supports it
|
|
const stream_name = sub.name;
|
|
return channel.post({
|
|
url: "/json/users/me/subscriptions",
|
|
data: {
|
|
subscriptions: JSON.stringify([{name: stream_name}]),
|
|
principals: JSON.stringify(user_ids),
|
|
},
|
|
success,
|
|
error: failure,
|
|
});
|
|
}
|
|
|
|
export function remove_user_id_from_stream(user_id, sub, success, failure) {
|
|
// TODO: use stream_id when backend supports it
|
|
const stream_name = sub.name;
|
|
return channel.del({
|
|
url: "/json/users/me/subscriptions",
|
|
data: {subscriptions: JSON.stringify([stream_name]), principals: JSON.stringify([user_id])},
|
|
success,
|
|
error: failure,
|
|
});
|
|
}
|