zulip/web/src/muted_users_ui.js
Anders Kaseorg c1675913a2 web: Move web app to ‘web’ directory.
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 <[email protected]>
2023-02-23 16:04:17 -08:00

68 lines
1.9 KiB
JavaScript

import render_confirm_mute_user from "../templates/confirm_dialog/confirm_mute_user.hbs";
import * as activity from "./activity";
import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog";
import {$t_html} from "./i18n";
import * as message_lists from "./message_lists";
import * as muted_users from "./muted_users";
import * as overlays from "./overlays";
import * as people from "./people";
import * as pm_list from "./pm_list";
import * as popovers from "./popovers";
import * as recent_topics_ui from "./recent_topics_ui";
import * as settings_muted_users from "./settings_muted_users";
export function mute_user(user_id) {
channel.post({
url: "/json/users/me/muted_users/" + user_id,
});
}
export function confirm_mute_user(user_id) {
function on_click() {
mute_user(user_id);
}
const html_body = render_confirm_mute_user({
user_name: people.get_full_name(user_id),
});
confirm_dialog.launch({
html_heading: $t_html({defaultMessage: "Mute user"}),
help_link: "/help/mute-a-user",
html_body,
on_click,
});
}
export function unmute_user(user_id) {
channel.del({
url: "/json/users/me/muted_users/" + user_id,
});
}
export function rerender_for_muted_user() {
message_lists.current.update_muting_and_rerender();
if (message_lists.current !== message_lists.home) {
message_lists.home.update_muting_and_rerender();
}
if (overlays.settings_open() && settings_muted_users.loaded) {
settings_muted_users.populate_list();
}
activity.redraw();
pm_list.update_private_messages();
// If a user is (un)muted, we want to update their avatars on the recent topics
// participants column.
recent_topics_ui.complete_rerender();
}
export function handle_user_updates(muted_user_ids) {
popovers.hide_all();
muted_users.set_muted_users(muted_user_ids);
rerender_for_muted_user();
}