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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:14:05 -08:00 committed by Tim Abbott
parent a832983290
commit 9a0fc5cc87
7 changed files with 12 additions and 19 deletions

View File

@ -187,7 +187,6 @@
"unread": false, "unread": false,
"unread_ops": false, "unread_ops": false,
"upload_widget": false, "upload_widget": false,
"user_events": false,
"widgetize": false, "widgetize": false,
"zxcvbn": false "zxcvbn": false
} }

View File

@ -74,7 +74,8 @@ rewiremock("../../static/js/submessage").with(submessage);
const typing_events = set_global("typing_events", {}); const typing_events = set_global("typing_events", {});
const ui = set_global("ui", {}); const ui = set_global("ui", {});
const unread_ops = set_global("unread_ops", {}); const unread_ops = set_global("unread_ops", {});
const user_events = set_global("user_events", {}); const user_events = {__esModule: true};
rewiremock("../../static/js/user_events").with(user_events);
const user_groups = {__esModule: true}; const user_groups = {__esModule: true};
rewiremock("../../static/js/user_groups").with(user_groups); rewiremock("../../static/js/user_groups").with(user_groups);

View File

@ -373,8 +373,6 @@ run_test("add_user_event", () => {
const noop = () => {}; const noop = () => {};
zrequire("user_events");
run_test("update_user_event", (override) => { run_test("update_user_event", (override) => {
const new_bob = { const new_bob = {
email: "bob@example.com", email: "bob@example.com",

View File

@ -33,7 +33,6 @@ import "../notifications";
import "../message_events"; import "../message_events";
import "../server_events"; import "../server_events";
import "../zulip"; import "../zulip";
import "../user_events";
import "../timerender"; import "../timerender";
import "../hotspots"; import "../hotspots";
import "../templates"; import "../templates";

View File

@ -57,7 +57,6 @@ declare let ui: any;
declare let unread: any; declare let unread: any;
declare let unread_ops: any; declare let unread_ops: any;
declare let upload_widget: any; declare let upload_widget: any;
declare let user_events: any;
declare let widgetize: any; declare let widgetize: any;
interface JQuery { interface JQuery {

View File

@ -24,6 +24,7 @@ import * as stream_data from "./stream_data";
import * as stream_events from "./stream_events"; import * as stream_events from "./stream_events";
import * as stream_topic_history from "./stream_topic_history"; import * as stream_topic_history from "./stream_topic_history";
import * as submessage from "./submessage"; import * as submessage from "./submessage";
import * as user_events from "./user_events";
import * as user_groups from "./user_groups"; import * as user_groups from "./user_groups";
import * as user_status from "./user_status"; import * as user_status from "./user_status";

View File

@ -1,19 +1,17 @@
"use strict";
// This module is kind of small, but it will help us keep // This module is kind of small, but it will help us keep
// server_events.js simple while breaking some circular // server_events.js simple while breaking some circular
// dependencies that existed when this code was in people.js. // dependencies that existed when this code was in people.js.
// (We should do bot updates here too.) // (We should do bot updates here too.)
const activity = require("./activity"); import * as activity from "./activity";
const compose = require("./compose"); import * as compose from "./compose";
const gear_menu = require("./gear_menu"); import * as gear_menu from "./gear_menu";
const message_live_update = require("./message_live_update"); import * as message_live_update from "./message_live_update";
const narrow_state = require("./narrow_state"); import * as narrow_state from "./narrow_state";
const people = require("./people"); import * as people from "./people";
const pm_list = require("./pm_list"); import * as pm_list from "./pm_list";
const settings_config = require("./settings_config"); import * as settings_config from "./settings_config";
exports.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);
if (!person_obj) { if (!person_obj) {
@ -106,5 +104,3 @@ exports.update_person = function update(person) {
person_obj.bot_owner_id = person.bot_owner_id; person_obj.bot_owner_id = person.bot_owner_id;
} }
}; };
window.user_events = exports;