mirror of https://github.com/zulip/zulip.git
js: Convert static/js/settings_users.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
2501a0412f
commit
793ff996f6
|
@ -161,7 +161,6 @@
|
||||||
"settings_profile_fields": false,
|
"settings_profile_fields": false,
|
||||||
"settings_streams": false,
|
"settings_streams": false,
|
||||||
"settings_user_groups": false,
|
"settings_user_groups": false,
|
||||||
"settings_users": false,
|
|
||||||
"stream_list": false,
|
"stream_list": false,
|
||||||
"StripeCheckout": false,
|
"StripeCheckout": false,
|
||||||
"subs": false,
|
"subs": false,
|
||||||
|
|
|
@ -74,7 +74,8 @@ rewiremock("../../static/js/settings_org").with(settings_org);
|
||||||
const settings_profile_fields = set_global("settings_profile_fields", {});
|
const settings_profile_fields = set_global("settings_profile_fields", {});
|
||||||
const settings_streams = set_global("settings_streams", {});
|
const settings_streams = set_global("settings_streams", {});
|
||||||
const settings_user_groups = set_global("settings_user_groups", {});
|
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};
|
const stream_data = {__esModule: true};
|
||||||
rewiremock("../../static/js/stream_data").with(stream_data);
|
rewiremock("../../static/js/stream_data").with(stream_data);
|
||||||
const stream_events = {__esModule: true};
|
const stream_events = {__esModule: true};
|
||||||
|
|
|
@ -27,7 +27,8 @@ const message_live_update = {__esModule: true};
|
||||||
rewiremock("../../static/js/message_live_update").with(message_live_update);
|
rewiremock("../../static/js/message_live_update").with(message_live_update);
|
||||||
const pm_list = {__esModule: true};
|
const pm_list = {__esModule: true};
|
||||||
rewiremock("../../static/js/pm_list").with(pm_list);
|
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 home_msg_list = set_global("home_msg_list", {});
|
||||||
const message_list = set_global("message_list", {});
|
const message_list = set_global("message_list", {});
|
||||||
const message_util = {__esModule: true};
|
const message_util = {__esModule: true};
|
||||||
|
|
|
@ -23,7 +23,7 @@ set_global("settings_profile_fields", {
|
||||||
set_global("settings_streams", {
|
set_global("settings_streams", {
|
||||||
maybe_disable_widgets() {},
|
maybe_disable_widgets() {},
|
||||||
});
|
});
|
||||||
set_global("settings_users", {
|
rewiremock("../../static/js/settings_users").with({
|
||||||
update_user_data() {},
|
update_user_data() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ import "../server_events";
|
||||||
import "../zulip";
|
import "../zulip";
|
||||||
import "../templates";
|
import "../templates";
|
||||||
import "../dropdown_list_widget";
|
import "../dropdown_list_widget";
|
||||||
import "../settings_users";
|
|
||||||
import "../settings_streams";
|
import "../settings_streams";
|
||||||
import "../settings_linkifiers";
|
import "../settings_linkifiers";
|
||||||
import "../settings_invites";
|
import "../settings_invites";
|
||||||
|
|
|
@ -33,7 +33,6 @@ declare let settings_linkifiers: any;
|
||||||
declare let settings_profile_fields: any;
|
declare let settings_profile_fields: any;
|
||||||
declare let settings_streams: any;
|
declare let settings_streams: any;
|
||||||
declare let settings_user_groups: any;
|
declare let settings_user_groups: any;
|
||||||
declare let settings_users: any;
|
|
||||||
declare let stream_list: any;
|
declare let stream_list: any;
|
||||||
declare let subs: any;
|
declare let subs: any;
|
||||||
declare let message_view_header: any;
|
declare let message_view_header: any;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import * as settings_emoji from "./settings_emoji";
|
||||||
import * as settings_exports from "./settings_exports";
|
import * as settings_exports from "./settings_exports";
|
||||||
import * as settings_notifications from "./settings_notifications";
|
import * as settings_notifications from "./settings_notifications";
|
||||||
import * as settings_org from "./settings_org";
|
import * as settings_org from "./settings_org";
|
||||||
|
import * as settings_users from "./settings_users";
|
||||||
import * as starred_messages from "./starred_messages";
|
import * as starred_messages from "./starred_messages";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
import * as stream_events from "./stream_events";
|
import * as stream_events from "./stream_events";
|
||||||
|
|
|
@ -8,6 +8,7 @@ import * as settings_exports from "./settings_exports";
|
||||||
import * as settings_muting from "./settings_muting";
|
import * as settings_muting from "./settings_muting";
|
||||||
import * as settings_notifications from "./settings_notifications";
|
import * as settings_notifications from "./settings_notifications";
|
||||||
import * as settings_org from "./settings_org";
|
import * as settings_org from "./settings_org";
|
||||||
|
import * as settings_users from "./settings_users";
|
||||||
|
|
||||||
const load_func_dict = new Map(); // group -> function
|
const load_func_dict = new Map(); // group -> function
|
||||||
const loaded_groups = new Set();
|
const loaded_groups = new Set();
|
||||||
|
|
|
@ -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");
|
import * as channel from "./channel";
|
||||||
const render_admin_human_form = require("../templates/admin_human_form.hbs");
|
import * as ListWidget from "./list_widget";
|
||||||
const render_admin_user_list = require("../templates/admin_user_list.hbs");
|
import * as loading from "./loading";
|
||||||
|
import * as overlays from "./overlays";
|
||||||
const channel = require("./channel");
|
import * as people from "./people";
|
||||||
const ListWidget = require("./list_widget");
|
import * as presence from "./presence";
|
||||||
const loading = require("./loading");
|
import * as settings_account from "./settings_account";
|
||||||
const overlays = require("./overlays");
|
import * as settings_bots from "./settings_bots";
|
||||||
const people = require("./people");
|
import * as settings_config from "./settings_config";
|
||||||
const presence = require("./presence");
|
import * as settings_data from "./settings_data";
|
||||||
const settings_account = require("./settings_account");
|
import * as settings_panel_menu from "./settings_panel_menu";
|
||||||
const settings_bots = require("./settings_bots");
|
import * as settings_ui from "./settings_ui";
|
||||||
const settings_config = require("./settings_config");
|
import * as timerender from "./timerender";
|
||||||
const settings_data = require("./settings_data");
|
import * as ui_report from "./ui_report";
|
||||||
const settings_panel_menu = require("./settings_panel_menu");
|
import * as user_pill from "./user_pill";
|
||||||
const settings_ui = require("./settings_ui");
|
|
||||||
const timerender = require("./timerender");
|
|
||||||
const ui_report = require("./ui_report");
|
|
||||||
const user_pill = require("./user_pill");
|
|
||||||
|
|
||||||
const section = {
|
const section = {
|
||||||
active: {},
|
active: {},
|
||||||
|
@ -352,15 +350,15 @@ section.deactivated.create_table = (deactivated_users) => {
|
||||||
$("#admin_deactivated_users_table").show();
|
$("#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) {
|
if (!bot_list_widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bot_list_widget.render_item(bot_user_id);
|
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);
|
const user_row = get_user_info_row(user_id);
|
||||||
|
|
||||||
if (user_row.length === 0) {
|
if (user_row.length === 0) {
|
||||||
|
@ -385,7 +383,7 @@ exports.update_user_data = function (user_id, new_data) {
|
||||||
if (new_data.role !== undefined) {
|
if (new_data.role !== undefined) {
|
||||||
user_row.find(".user_role").text(people.get_user_type(user_id));
|
user_row.find(".user_role").text(people.get_user_type(user_id));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function start_data_load() {
|
function start_data_load() {
|
||||||
loading.make_indicator($("#admin_page_users_loading_indicator"), {text: "Loading..."});
|
loading.make_indicator($("#admin_page_users_loading_indicator"), {text: "Loading..."});
|
||||||
|
@ -696,15 +694,13 @@ section.bots.handle_events = () => {
|
||||||
handle_bot_form(tbody, status_field);
|
handle_bot_form(tbody, status_field);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.set_up_humans = function () {
|
export function set_up_humans() {
|
||||||
start_data_load();
|
start_data_load();
|
||||||
section.active.handle_events();
|
section.active.handle_events();
|
||||||
section.deactivated.handle_events();
|
section.deactivated.handle_events();
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.set_up_bots = function () {
|
export function set_up_bots() {
|
||||||
section.bots.handle_events();
|
section.bots.handle_events();
|
||||||
section.bots.create_table();
|
section.bots.create_table();
|
||||||
};
|
}
|
||||||
|
|
||||||
window.settings_users = exports;
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import * as pm_list from "./pm_list";
|
||||||
import * as settings_account from "./settings_account";
|
import * as settings_account from "./settings_account";
|
||||||
import * as settings_config from "./settings_config";
|
import * as settings_config from "./settings_config";
|
||||||
import * as settings_org from "./settings_org";
|
import * as settings_org from "./settings_org";
|
||||||
|
import * as settings_users from "./settings_users";
|
||||||
|
|
||||||
export const update_person = function update(person) {
|
export const update_person = function update(person) {
|
||||||
const person_obj = people.get_by_user_id(person.user_id);
|
const person_obj = people.get_by_user_id(person.user_id);
|
||||||
|
|
Loading…
Reference in New Issue