mirror of https://github.com/zulip/zulip.git
js: Convert static/js/settings_emoji.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
f94b29356c
commit
6ffcc0d25b
|
@ -156,7 +156,6 @@
|
|||
"recent_topics": false,
|
||||
"search_pill_widget": false,
|
||||
"settings": false,
|
||||
"settings_emoji": false,
|
||||
"settings_exports": false,
|
||||
"settings_linkifiers": false,
|
||||
"settings_invites": false,
|
||||
|
|
|
@ -61,7 +61,8 @@ const settings_bots = {__esModule: true};
|
|||
rewiremock("../../static/js/settings_bots").with(settings_bots);
|
||||
const settings_display = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_display").with(settings_display);
|
||||
const settings_emoji = set_global("settings_emoji", {});
|
||||
const settings_emoji = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_emoji").with(settings_emoji);
|
||||
const settings_exports = set_global("settings_exports", {});
|
||||
const settings_invites = set_global("settings_invites", {});
|
||||
const settings_linkifiers = set_global("settings_linkifiers", {});
|
||||
|
|
|
@ -7,6 +7,7 @@ const overlays = require("./overlays");
|
|||
const settings_bots = require("./settings_bots");
|
||||
const settings_config = require("./settings_config");
|
||||
const settings_data = require("./settings_data");
|
||||
const settings_emoji = require("./settings_emoji");
|
||||
const settings_panel_menu = require("./settings_panel_menu");
|
||||
const settings_sections = require("./settings_sections");
|
||||
const settings_toggle = require("./settings_toggle");
|
||||
|
|
|
@ -35,7 +35,6 @@ import "../server_events";
|
|||
import "../zulip";
|
||||
import "../templates";
|
||||
import "../dropdown_list_widget";
|
||||
import "../settings_emoji";
|
||||
import "../settings_exports";
|
||||
import "../settings_org";
|
||||
import "../settings_users";
|
||||
|
|
|
@ -28,7 +28,6 @@ declare let reactions: any;
|
|||
declare let recent_topics: any;
|
||||
declare let search_pill_widget: any;
|
||||
declare let settings: any;
|
||||
declare let settings_emoji: any;
|
||||
declare let settings_exports: any;
|
||||
declare let settings_invites: any;
|
||||
declare let settings_linkifiers: any;
|
||||
|
|
|
@ -25,6 +25,7 @@ import * as settings_account from "./settings_account";
|
|||
import * as settings_bots from "./settings_bots";
|
||||
import * as settings_config from "./settings_config";
|
||||
import * as settings_display from "./settings_display";
|
||||
import * as settings_emoji from "./settings_emoji";
|
||||
import * as settings_notifications from "./settings_notifications";
|
||||
import * as starred_messages from "./starred_messages";
|
||||
import * as stream_data from "./stream_data";
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
"use strict";
|
||||
import * as emoji from "../shared/js/emoji";
|
||||
import render_admin_emoji_list from "../templates/admin_emoji_list.hbs";
|
||||
import render_settings_emoji_settings_tip from "../templates/settings/emoji_settings_tip.hbs";
|
||||
|
||||
const emoji = require("../shared/js/emoji");
|
||||
const render_admin_emoji_list = require("../templates/admin_emoji_list.hbs");
|
||||
const render_settings_emoji_settings_tip = require("../templates/settings/emoji_settings_tip.hbs");
|
||||
|
||||
const channel = require("./channel");
|
||||
const ListWidget = require("./list_widget");
|
||||
const loading = require("./loading");
|
||||
const people = require("./people");
|
||||
const ui_report = require("./ui_report");
|
||||
const upload_widget = require("./upload_widget");
|
||||
import * as channel from "./channel";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as loading from "./loading";
|
||||
import * as people from "./people";
|
||||
import * as ui_report from "./ui_report";
|
||||
import * as upload_widget from "./upload_widget";
|
||||
|
||||
const meta = {
|
||||
loaded: false,
|
||||
};
|
||||
|
||||
exports.can_add_emoji = function () {
|
||||
export function can_add_emoji() {
|
||||
if (page_params.is_guest) {
|
||||
return false;
|
||||
}
|
||||
|
@ -26,7 +24,7 @@ exports.can_add_emoji = function () {
|
|||
|
||||
// for normal users, we depend on the setting
|
||||
return !page_params.realm_add_emoji_by_admins_only;
|
||||
};
|
||||
}
|
||||
|
||||
function can_admin_emoji(emoji) {
|
||||
if (page_params.is_admin) {
|
||||
|
@ -42,7 +40,7 @@ function can_admin_emoji(emoji) {
|
|||
return false;
|
||||
}
|
||||
|
||||
exports.update_custom_emoji_ui = function () {
|
||||
export function update_custom_emoji_ui() {
|
||||
const rendered_tip = render_settings_emoji_settings_tip({
|
||||
realm_add_emoji_by_admins_only: page_params.realm_add_emoji_by_admins_only,
|
||||
});
|
||||
|
@ -55,12 +53,12 @@ exports.update_custom_emoji_ui = function () {
|
|||
$(".admin-emoji-form").show();
|
||||
}
|
||||
|
||||
exports.populate_emoji();
|
||||
};
|
||||
populate_emoji();
|
||||
}
|
||||
|
||||
exports.reset = function () {
|
||||
export function reset() {
|
||||
meta.loaded = false;
|
||||
};
|
||||
}
|
||||
|
||||
function sort_author_full_name(a, b) {
|
||||
if (a.author.full_name > b.author.full_name) {
|
||||
|
@ -71,7 +69,7 @@ function sort_author_full_name(a, b) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
exports.populate_emoji = function () {
|
||||
export function populate_emoji() {
|
||||
if (!meta.loaded) {
|
||||
return;
|
||||
}
|
||||
|
@ -122,9 +120,9 @@ exports.populate_emoji = function () {
|
|||
});
|
||||
|
||||
loading.destroy_indicator($("#admin_page_emoji_loading_indicator"));
|
||||
};
|
||||
}
|
||||
|
||||
exports.build_emoji_upload_widget = function () {
|
||||
export function build_emoji_upload_widget() {
|
||||
const get_file_input = function () {
|
||||
return $("#emoji_file_input");
|
||||
};
|
||||
|
@ -145,15 +143,15 @@ exports.build_emoji_upload_widget = function () {
|
|||
preview_text,
|
||||
preview_image,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
exports.set_up = function () {
|
||||
export function set_up() {
|
||||
meta.loaded = true;
|
||||
|
||||
loading.make_indicator($("#admin_page_emoji_loading_indicator"));
|
||||
|
||||
// Populate emoji table
|
||||
exports.populate_emoji();
|
||||
populate_emoji();
|
||||
|
||||
$(".admin_emoji_table").on("click", ".delete", function (e) {
|
||||
e.preventDefault();
|
||||
|
@ -172,7 +170,7 @@ exports.set_up = function () {
|
|||
});
|
||||
});
|
||||
|
||||
const emoji_widget = exports.build_emoji_upload_widget();
|
||||
const emoji_widget = build_emoji_upload_widget();
|
||||
|
||||
$(".organization form.admin-emoji-form")
|
||||
.off("submit")
|
||||
|
@ -218,6 +216,4 @@ exports.set_up = function () {
|
|||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.settings_emoji = exports;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import * as attachments_ui from "./attachments_ui";
|
|||
import * as settings_account from "./settings_account";
|
||||
import * as settings_bots from "./settings_bots";
|
||||
import * as settings_display from "./settings_display";
|
||||
import * as settings_emoji from "./settings_emoji";
|
||||
import * as settings_muting from "./settings_muting";
|
||||
import * as settings_notifications from "./settings_notifications";
|
||||
|
||||
|
|
Loading…
Reference in New Issue