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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-23 20:00:56 -08:00 committed by Tim Abbott
parent f9c4b5438e
commit 6ff28577cc
13 changed files with 9 additions and 20 deletions

View File

@ -127,7 +127,6 @@
"globals": { "globals": {
"$": false, "$": false,
"Filter": false, "Filter": false,
"MessageListData": false,
"MessageListView": false, "MessageListView": false,
"activity": false, "activity": false,
"admin": false, "admin": false,

View File

@ -20,7 +20,6 @@ function MessageListView() {
set_global("MessageListView", MessageListView); set_global("MessageListView", MessageListView);
const Filter = zrequire("Filter", "js/filter"); const Filter = zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
const message_list = zrequire("message_list"); const message_list = zrequire("message_list");
const people = zrequire("people"); const people = zrequire("people");

View File

@ -26,7 +26,6 @@ const narrow_state = set_global("narrow_state", {});
const stream_data = set_global("stream_data", {}); const stream_data = set_global("stream_data", {});
const muting = zrequire("muting"); const muting = zrequire("muting");
zrequire("MessageListData", "js/message_list_data");
zrequire("MessageListView", "js/message_list_view"); zrequire("MessageListView", "js/message_list_view");
const {MessageList} = zrequire("message_list"); const {MessageList} = zrequire("message_list");

View File

@ -9,7 +9,7 @@ const muting = zrequire("muting");
zrequire("unread"); zrequire("unread");
zrequire("Filter", "js/filter"); zrequire("Filter", "js/filter");
const MessageListData = zrequire("MessageListData", "js/message_list_data"); const {MessageListData} = zrequire("MessageListData", "js/message_list_data");
set_global("page_params", {}); set_global("page_params", {});

View File

@ -10,7 +10,6 @@ const {run_test} = require("../zjsunit/test");
set_global("document", "document-stub"); set_global("document", "document-stub");
const Filter = zrequire("Filter", "js/filter"); const Filter = zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
const MessageListView = zrequire("MessageListView", "js/message_list_view"); const MessageListView = zrequire("MessageListView", "js/message_list_view");
const message_list = zrequire("message_list"); const message_list = zrequire("message_list");

View File

@ -13,7 +13,6 @@ set_global("resize", {
}); });
const stream_data = zrequire("stream_data"); const stream_data = zrequire("stream_data");
zrequire("Filter", "js/filter"); zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
zrequire("unread"); zrequire("unread");
const narrow = zrequire("narrow"); const narrow = zrequire("narrow");

View File

@ -6,7 +6,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const Filter = zrequire("Filter", "js/filter"); const Filter = zrequire("Filter", "js/filter");
const MessageListData = zrequire("MessageListData", "js/message_list_data"); const {MessageListData} = zrequire("MessageListData", "js/message_list_data");
const narrow_state = zrequire("narrow_state"); const narrow_state = zrequire("narrow_state");
const narrow = zrequire("narrow"); const narrow = zrequire("narrow");
zrequire("stream_data"); zrequire("stream_data");

View File

@ -20,7 +20,6 @@ const people = zrequire("people");
const stream_color = zrequire("stream_color"); const stream_color = zrequire("stream_color");
const stream_data = zrequire("stream_data"); const stream_data = zrequire("stream_data");
zrequire("Filter", "js/filter"); zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
zrequire("MessageListView", "js/message_list_view"); zrequire("MessageListView", "js/message_list_view");
const message_list = zrequire("message_list"); const message_list = zrequire("message_list");
const settings_config = zrequire("settings_config"); const settings_config = zrequire("settings_config");

View File

@ -44,7 +44,6 @@ import "../filter";
import "../poll_widget"; import "../poll_widget";
import "../widgetize"; import "../widgetize";
import "../submessage"; import "../submessage";
import "../message_list_data";
import "../message_list_view"; import "../message_list_view";
import "../message_list"; import "../message_list";
import "../message_live_update"; import "../message_live_update";

View File

@ -4,7 +4,6 @@
// to TS. // to TS.
declare let Filter: any; declare let Filter: any;
declare let MessageListData: any;
declare let MessageListView: any; declare let MessageListView: any;
declare let activity: any; declare let activity: any;
declare let admin: any; declare let admin: any;

View File

@ -2,6 +2,8 @@
const autosize = require("autosize"); const autosize = require("autosize");
const {MessageListData} = require("./message_list_data");
exports.narrowed = undefined; exports.narrowed = undefined;
exports.set_narrowed = function (value) { exports.set_narrowed = function (value) {
exports.narrowed = value; exports.narrowed = value;

View File

@ -1,11 +1,9 @@
"use strict"; import _ from "lodash";
const _ = require("lodash"); import {FetchStatus} from "./fetch_status";
import * as util from "./util";
const {FetchStatus} = require("./fetch_status"); export class MessageListData {
const util = require("./util");
class MessageListData {
constructor(opts) { constructor(opts) {
this.excludes_muted_topics = opts.excludes_muted_topics; this.excludes_muted_topics = opts.excludes_muted_topics;
if (this.excludes_muted_topics) { if (this.excludes_muted_topics) {
@ -521,7 +519,3 @@ class MessageListData {
return msg; return msg;
} }
} }
module.exports = MessageListData;
window.MessageListData = MessageListData;

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
const {MessageListData} = require("./message_list_data");
const people = require("./people"); const people = require("./people");
const search_pill = require("./search_pill"); const search_pill = require("./search_pill");
const topic_generator = require("./topic_generator"); const topic_generator = require("./topic_generator");