js: Convert static/js/settings_users.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:21:11 -08:00 committed by Tim Abbott
parent 2501a0412f
commit 793ff996f6
10 changed files with 34 additions and 36 deletions

View File

@ -161,7 +161,6 @@
"settings_profile_fields": false,
"settings_streams": false,
"settings_user_groups": false,
"settings_users": false,
"stream_list": false,
"StripeCheckout": false,
"subs": false,

View File

@ -74,7 +74,8 @@ rewiremock("../../static/js/settings_org").with(settings_org);
const settings_profile_fields = set_global("settings_profile_fields", {});
const settings_streams = set_global("settings_streams", {});
const settings_user_groups = set_global("settings_user_groups", {});
const settings_users = set_global("settings_users", {});
const settings_users = {__esModule: true};
rewiremock("../../static/js/settings_users").with(settings_users);
const stream_data = {__esModule: true};
rewiremock("../../static/js/stream_data").with(stream_data);
const stream_events = {__esModule: true};

View File

@ -27,7 +27,8 @@ const message_live_update = {__esModule: true};
rewiremock("../../static/js/message_live_update").with(message_live_update);
const pm_list = {__esModule: true};
rewiremock("../../static/js/pm_list").with(pm_list);
const settings_users = set_global("settings_users", {});
const settings_users = {__esModule: true};
rewiremock("../../static/js/settings_users").with(settings_users);
const home_msg_list = set_global("home_msg_list", {});
const message_list = set_global("message_list", {});
const message_util = {__esModule: true};

View File

@ -23,7 +23,7 @@ set_global("settings_profile_fields", {
set_global("settings_streams", {
maybe_disable_widgets() {},
});
set_global("settings_users", {
rewiremock("../../static/js/settings_users").with({
update_user_data() {},
});

View File

@ -35,7 +35,6 @@ import "../server_events";
import "../zulip";
import "../templates";
import "../dropdown_list_widget";
import "../settings_users";
import "../settings_streams";
import "../settings_linkifiers";
import "../settings_invites";

View File

@ -33,7 +33,6 @@ declare let settings_linkifiers: any;
declare let settings_profile_fields: any;
declare let settings_streams: any;
declare let settings_user_groups: any;
declare let settings_users: any;
declare let stream_list: any;
declare let subs: any;
declare let message_view_header: any;

View File

@ -29,6 +29,7 @@ import * as settings_emoji from "./settings_emoji";
import * as settings_exports from "./settings_exports";
import * as settings_notifications from "./settings_notifications";
import * as settings_org from "./settings_org";
import * as settings_users from "./settings_users";
import * as starred_messages from "./starred_messages";
import * as stream_data from "./stream_data";
import * as stream_events from "./stream_events";

View File

@ -8,6 +8,7 @@ import * as settings_exports from "./settings_exports";
import * as settings_muting from "./settings_muting";
import * as settings_notifications from "./settings_notifications";
import * as settings_org from "./settings_org";
import * as settings_users from "./settings_users";
const load_func_dict = new Map(); // group -> function
const loaded_groups = new Set();

View File

@ -1,24 +1,22 @@
"use strict";
import render_admin_bot_form from "../templates/admin_bot_form.hbs";
import render_admin_human_form from "../templates/admin_human_form.hbs";
import render_admin_user_list from "../templates/admin_user_list.hbs";
const render_admin_bot_form = require("../templates/admin_bot_form.hbs");
const render_admin_human_form = require("../templates/admin_human_form.hbs");
const render_admin_user_list = require("../templates/admin_user_list.hbs");
const channel = require("./channel");
const ListWidget = require("./list_widget");
const loading = require("./loading");
const overlays = require("./overlays");
const people = require("./people");
const presence = require("./presence");
const settings_account = require("./settings_account");
const settings_bots = require("./settings_bots");
const settings_config = require("./settings_config");
const settings_data = require("./settings_data");
const settings_panel_menu = require("./settings_panel_menu");
const settings_ui = require("./settings_ui");
const timerender = require("./timerender");
const ui_report = require("./ui_report");
const user_pill = require("./user_pill");
import * as channel from "./channel";
import * as ListWidget from "./list_widget";
import * as loading from "./loading";
import * as overlays from "./overlays";
import * as people from "./people";
import * as presence from "./presence";
import * as settings_account from "./settings_account";
import * as settings_bots from "./settings_bots";
import * as settings_config from "./settings_config";
import * as settings_data from "./settings_data";
import * as settings_panel_menu from "./settings_panel_menu";
import * as settings_ui from "./settings_ui";
import * as timerender from "./timerender";
import * as ui_report from "./ui_report";
import * as user_pill from "./user_pill";
const section = {
active: {},
@ -352,15 +350,15 @@ section.deactivated.create_table = (deactivated_users) => {
$("#admin_deactivated_users_table").show();
};
exports.update_bot_data = function (bot_user_id) {
export function update_bot_data(bot_user_id) {
if (!bot_list_widget) {
return;
}
bot_list_widget.render_item(bot_user_id);
};
}
exports.update_user_data = function (user_id, new_data) {
export function update_user_data(user_id, new_data) {
const user_row = get_user_info_row(user_id);
if (user_row.length === 0) {
@ -385,7 +383,7 @@ exports.update_user_data = function (user_id, new_data) {
if (new_data.role !== undefined) {
user_row.find(".user_role").text(people.get_user_type(user_id));
}
};
}
function start_data_load() {
loading.make_indicator($("#admin_page_users_loading_indicator"), {text: "Loading..."});
@ -696,15 +694,13 @@ section.bots.handle_events = () => {
handle_bot_form(tbody, status_field);
};
exports.set_up_humans = function () {
export function set_up_humans() {
start_data_load();
section.active.handle_events();
section.deactivated.handle_events();
};
}
exports.set_up_bots = function () {
export function set_up_bots() {
section.bots.handle_events();
section.bots.create_table();
};
window.settings_users = exports;
}

View File

@ -12,6 +12,7 @@ import * as pm_list from "./pm_list";
import * as settings_account from "./settings_account";
import * as settings_config from "./settings_config";
import * as settings_org from "./settings_org";
import * as settings_users from "./settings_users";
export const update_person = function update(person) {
const person_obj = people.get_by_user_id(person.user_id);