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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:21:57 -08:00 committed by Tim Abbott
parent 8953c9b6d6
commit e9c65834ff
9 changed files with 24 additions and 27 deletions

View File

@ -156,7 +156,6 @@
"recent_topics": false, "recent_topics": false,
"search_pill_widget": false, "search_pill_widget": false,
"settings": false, "settings": false,
"settings_linkifiers": false,
"settings_invites": false, "settings_invites": false,
"settings_profile_fields": false, "settings_profile_fields": false,
"settings_user_groups": false, "settings_user_groups": false,

View File

@ -66,7 +66,8 @@ rewiremock("../../static/js/settings_emoji").with(settings_emoji);
const settings_exports = {__esModule: true}; const settings_exports = {__esModule: true};
rewiremock("../../static/js/settings_exports").with(settings_exports); rewiremock("../../static/js/settings_exports").with(settings_exports);
const settings_invites = set_global("settings_invites", {}); const settings_invites = set_global("settings_invites", {});
const settings_linkifiers = set_global("settings_linkifiers", {}); const settings_linkifiers = {__esModule: true};
rewiremock("../../static/js/settings_linkifiers").with(settings_linkifiers);
const settings_notifications = {__esModule: true}; const settings_notifications = {__esModule: true};
rewiremock("../../static/js/settings_notifications").with(settings_notifications); rewiremock("../../static/js/settings_notifications").with(settings_notifications);
const settings_org = {__esModule: true}; const settings_org = {__esModule: true};

View File

@ -11,7 +11,7 @@ rewiremock("../../static/js/activity").with({
redraw() {}, redraw() {},
}); });
set_global("settings_linkifiers", { rewiremock("../../static/js/settings_linkifiers").with({
maybe_disable_widgets() {}, maybe_disable_widgets() {},
}); });
rewiremock("../../static/js/settings_org").with({ rewiremock("../../static/js/settings_org").with({

View File

@ -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_linkifiers";
import "../settings_invites"; import "../settings_invites";
import "../settings_user_groups"; import "../settings_user_groups";
import "../settings_profile_fields"; import "../settings_profile_fields";

View File

@ -29,7 +29,6 @@ declare let recent_topics: any;
declare let search_pill_widget: any; declare let search_pill_widget: any;
declare let settings: any; declare let settings: any;
declare let settings_invites: any; declare let settings_invites: any;
declare let settings_linkifiers: any;
declare let settings_profile_fields: any; declare let settings_profile_fields: any;
declare let settings_user_groups: any; declare let settings_user_groups: any;
declare let stream_list: any; declare let stream_list: any;

View File

@ -27,6 +27,7 @@ import * as settings_config from "./settings_config";
import * as settings_display from "./settings_display"; import * as settings_display from "./settings_display";
import * as settings_emoji from "./settings_emoji"; import * as settings_emoji from "./settings_emoji";
import * as settings_exports from "./settings_exports"; import * as settings_exports from "./settings_exports";
import * as settings_linkifiers from "./settings_linkifiers";
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_streams from "./settings_streams"; import * as settings_streams from "./settings_streams";

View File

@ -1,25 +1,23 @@
"use strict"; import render_admin_filter_list from "../templates/admin_filter_list.hbs";
const render_admin_filter_list = require("../templates/admin_filter_list.hbs"); import * as channel from "./channel";
import * as ListWidget from "./list_widget";
const channel = require("./channel"); import * as loading from "./loading";
const ListWidget = require("./list_widget"); import * as ui_report from "./ui_report";
const loading = require("./loading");
const ui_report = require("./ui_report");
const meta = { const meta = {
loaded: false, loaded: false,
}; };
exports.reset = function () { export function reset() {
meta.loaded = false; meta.loaded = false;
}; }
exports.maybe_disable_widgets = function () { export function maybe_disable_widgets() {
if (page_params.is_admin) { if (page_params.is_admin) {
return; return;
} }
}; }
function compare_by_index(a, b, i) { function compare_by_index(a, b, i) {
if (a[i] > b[i]) { if (a[i] > b[i]) {
@ -38,7 +36,7 @@ function sort_url(a, b) {
return compare_by_index(a, b, 1); return compare_by_index(a, b, 1);
} }
exports.populate_filters = function (filters_data) { export function populate_filters(filters_data) {
if (!meta.loaded) { if (!meta.loaded) {
return; return;
} }
@ -77,21 +75,21 @@ exports.populate_filters = function (filters_data) {
}); });
loading.destroy_indicator($("#admin_page_filters_loading_indicator")); loading.destroy_indicator($("#admin_page_filters_loading_indicator"));
}; }
exports.set_up = function () { export function set_up() {
exports.build_page(); build_page();
exports.maybe_disable_widgets(); maybe_disable_widgets();
}; }
exports.build_page = function () { export function build_page() {
meta.loaded = true; meta.loaded = true;
// create loading indicators // create loading indicators
loading.make_indicator($("#admin_page_filters_loading_indicator")); loading.make_indicator($("#admin_page_filters_loading_indicator"));
// Populate filters table // Populate filters table
exports.populate_filters(page_params.realm_filters); populate_filters(page_params.realm_filters);
$(".admin_filters_table").on("click", ".delete", function (e) { $(".admin_filters_table").on("click", ".delete", function (e) {
e.preventDefault(); e.preventDefault();
@ -157,6 +155,4 @@ exports.build_page = function () {
}, },
}); });
}); });
}; }
window.settings_linkifiers = exports;

View File

@ -5,6 +5,7 @@ import * as settings_bots from "./settings_bots";
import * as settings_display from "./settings_display"; import * as settings_display from "./settings_display";
import * as settings_emoji from "./settings_emoji"; import * as settings_emoji from "./settings_emoji";
import * as settings_exports from "./settings_exports"; import * as settings_exports from "./settings_exports";
import * as settings_linkifiers from "./settings_linkifiers";
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";

View File

@ -11,6 +11,7 @@ import * as people from "./people";
import * as pm_list from "./pm_list"; 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_linkifiers from "./settings_linkifiers";
import * as settings_org from "./settings_org"; import * as settings_org from "./settings_org";
import * as settings_streams from "./settings_streams"; import * as settings_streams from "./settings_streams";
import * as settings_users from "./settings_users"; import * as settings_users from "./settings_users";