Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/topic_generator.js to ES6 module.
Anders Kaseorg07e6de1cd99f
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 380533a79a0..fa5f3949754 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -281,7 +281,6 @@"timerender": false,"todo_widget": false,"top_left_corner": false,- "topic_generator": false,"topic_list": false,"topic_zoom": false,"transmit": false,diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex c970c8284dd..d5c3d203154 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -39,7 +39,6 @@ import "../topic_list";import "../pm_list_dom";import "../pm_list";import "../recent_senders";-import "../topic_generator";import "../top_left_corner";import "../stream_list";import "../topic_zoom";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex 92eea642ff5..40801b8739a 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -146,7 +146,6 @@ declare let templates: any;declare let timerender: any;declare let todo_widget: any;declare let stream_topic_history: any;-declare let topic_generator: any;declare let topic_list: any;declare let topic_zoom: any;declare let top_left_corner: any;diff --git a/static/js/narrow.js b/static/js/narrow.jsindex 59b9e5867ee..99e30ffca6f 100644--- a/static/js/narrow.js+++ b/static/js/narrow.js@@ -1,6 +1,7 @@"use strict";const people = require("./people");+const topic_generator = require("./topic_generator");const util = require("./util");let unnarrow_times;diff --git a/static/js/topic_generator.js b/static/js/topic_generator.jsindex b34c2d850e7..a2f06daa168 100644--- a/static/js/topic_generator.js+++ b/static/js/topic_generator.js@@ -1,9 +1,7 @@-"use strict";+import * as pm_conversations from "./pm_conversations";+import * as stream_sort from "./stream_sort";-const pm_conversations = require("./pm_conversations");-const stream_sort = require("./stream_sort");--exports.next_topic = function (streams, get_topics, has_unread_messages, curr_stream, curr_topic) {+export function next_topic(streams, get_topics, has_unread_messages, curr_stream, curr_topic) {const curr_stream_index = streams.indexOf(curr_stream); // -1 if not foundif (curr_stream_index >= 0) {@@ -45,9 +43,9 @@ exports.next_topic = function (streams, get_topics, has_unread_messages, curr_st}return undefined;-};+}-exports.get_next_topic = function (curr_stream, curr_topic) {+export function get_next_topic(curr_stream, curr_topic) {let my_streams = stream_sort.get_streams();my_streams = my_streams.filter((stream_name) => {@@ -74,16 +72,10 @@ exports.get_next_topic = function (curr_stream, curr_topic) {return unread.topic_has_any_unread(stream_id, topic);}- return exports.next_topic(- my_streams,- get_unmuted_topics,- has_unread_messages,- curr_stream,- curr_topic,- );-};+ return next_topic(my_streams, get_unmuted_topics, has_unread_messages, curr_stream, curr_topic);+}-exports.get_next_unread_pm_string = function (curr_pm) {+export function get_next_unread_pm_string(curr_pm) {const my_pm_strings = pm_conversations.recent.get_strings();const curr_pm_index = my_pm_strings.indexOf(curr_pm); // -1 if not found@@ -100,9 +92,9 @@ exports.get_next_unread_pm_string = function (curr_pm) {}return undefined;-};+}-exports.get_next_stream = function (curr_stream) {+export function get_next_stream(curr_stream) {const my_streams = stream_sort.get_streams();const curr_stream_index = my_streams.indexOf(curr_stream);return my_streams[@@ -110,12 +102,10 @@ exports.get_next_stream = function (curr_stream) {? 0: curr_stream_index + 1];-};+}-exports.get_prev_stream = function (curr_stream) {+export function get_prev_stream(curr_stream) {const my_streams = stream_sort.get_streams();const curr_stream_index = my_streams.indexOf(curr_stream);return my_streams[curr_stream_index <= 0 ? my_streams.length - 1 : curr_stream_index - 1];-};--window.topic_generator = exports;+}