mirror of https://github.com/zulip/zulip.git
js: Convert static/js/avatar.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
e64c7a9efe
commit
b2849edfd7
|
@ -126,7 +126,6 @@
|
||||||
"globals": {
|
"globals": {
|
||||||
"$": false,
|
"$": false,
|
||||||
"admin": false,
|
"admin": false,
|
||||||
"avatar": false,
|
|
||||||
"blueslip": false,
|
"blueslip": false,
|
||||||
"bot_data": false,
|
"bot_data": false,
|
||||||
"compose_actions": false,
|
"compose_actions": false,
|
||||||
|
|
|
@ -29,7 +29,9 @@ const bot_data_params = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const avatar = set_global("avatar", {});
|
const avatar = {__esModule: true};
|
||||||
|
|
||||||
|
rewiremock("../../static/js/avatar").with(avatar);
|
||||||
|
|
||||||
function ClipboardJS(sel) {
|
function ClipboardJS(sel) {
|
||||||
assert.equal(sel, "#copy_zuliprc");
|
assert.equal(sel, "#copy_zuliprc");
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
"use strict";
|
import * as channel from "./channel";
|
||||||
|
import * as upload_widget from "./upload_widget";
|
||||||
|
|
||||||
const channel = require("./channel");
|
export function build_bot_create_widget() {
|
||||||
const upload_widget = require("./upload_widget");
|
|
||||||
|
|
||||||
exports.build_bot_create_widget = function () {
|
|
||||||
// We have to do strange gyrations with the file input to clear it,
|
// We have to do strange gyrations with the file input to clear it,
|
||||||
// where we replace it wholesale, so we generalize the file input with
|
// where we replace it wholesale, so we generalize the file input with
|
||||||
// a callback function.
|
// a callback function.
|
||||||
|
@ -23,9 +21,9 @@ exports.build_bot_create_widget = function () {
|
||||||
clear_button,
|
clear_button,
|
||||||
upload_button,
|
upload_button,
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.build_bot_edit_widget = function (target) {
|
export function build_bot_edit_widget(target) {
|
||||||
const get_file_input = function () {
|
const get_file_input = function () {
|
||||||
return target.find(".edit_bot_avatar_file_input");
|
return target.find(".edit_bot_avatar_file_input");
|
||||||
};
|
};
|
||||||
|
@ -42,9 +40,9 @@ exports.build_bot_edit_widget = function (target) {
|
||||||
clear_button,
|
clear_button,
|
||||||
upload_button,
|
upload_button,
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.build_user_avatar_widget = function (upload_function) {
|
export function build_user_avatar_widget(upload_function) {
|
||||||
const get_file_input = function () {
|
const get_file_input = function () {
|
||||||
return $("#user-avatar-upload-widget .image_file_input").expectOne();
|
return $("#user-avatar-upload-widget .image_file_input").expectOne();
|
||||||
};
|
};
|
||||||
|
@ -83,6 +81,4 @@ exports.build_user_avatar_widget = function (upload_function) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
}
|
||||||
|
|
||||||
window.avatar = exports;
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import "../message_events";
|
||||||
import "../server_events";
|
import "../server_events";
|
||||||
import "../zulip";
|
import "../zulip";
|
||||||
import "../templates";
|
import "../templates";
|
||||||
import "../avatar";
|
|
||||||
import "../realm_icon";
|
import "../realm_icon";
|
||||||
import "../realm_logo";
|
import "../realm_logo";
|
||||||
import "../reminder";
|
import "../reminder";
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
// to TS.
|
// to TS.
|
||||||
|
|
||||||
declare let admin: any;
|
declare let admin: any;
|
||||||
declare let avatar: any;
|
|
||||||
declare let blueslip: any;
|
declare let blueslip: any;
|
||||||
declare let bot_data: any;
|
declare let bot_data: any;
|
||||||
declare let compose_actions: any;
|
declare let compose_actions: any;
|
||||||
|
|
|
@ -6,6 +6,7 @@ const render_settings_api_key_modal = require("../templates/settings/api_key_mod
|
||||||
const render_settings_custom_user_profile_field = require("../templates/settings/custom_user_profile_field.hbs");
|
const render_settings_custom_user_profile_field = require("../templates/settings/custom_user_profile_field.hbs");
|
||||||
const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs");
|
const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs");
|
||||||
|
|
||||||
|
const avatar = require("./avatar");
|
||||||
const channel = require("./channel");
|
const channel = require("./channel");
|
||||||
const common = require("./common");
|
const common = require("./common");
|
||||||
const overlays = require("./overlays");
|
const overlays = require("./overlays");
|
||||||
|
|
|
@ -7,6 +7,7 @@ const render_edit_bot = require("../templates/edit_bot.hbs");
|
||||||
const render_settings_edit_embedded_bot_service = require("../templates/settings/edit_embedded_bot_service.hbs");
|
const render_settings_edit_embedded_bot_service = require("../templates/settings/edit_embedded_bot_service.hbs");
|
||||||
const render_settings_edit_outgoing_webhook_service = require("../templates/settings/edit_outgoing_webhook_service.hbs");
|
const render_settings_edit_outgoing_webhook_service = require("../templates/settings/edit_outgoing_webhook_service.hbs");
|
||||||
|
|
||||||
|
const avatar = require("./avatar");
|
||||||
const channel = require("./channel");
|
const channel = require("./channel");
|
||||||
const loading = require("./loading");
|
const loading = require("./loading");
|
||||||
const overlays = require("./overlays");
|
const overlays = require("./overlays");
|
||||||
|
|
Loading…
Reference in New Issue