mirror of https://github.com/zulip/zulip.git
js: Convert static/js/top_left_corner.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
1b151d0472
commit
16668904c1
|
@ -238,7 +238,6 @@
|
|||
"subs": false,
|
||||
"message_view_header": false,
|
||||
"timerender": false,
|
||||
"top_left_corner": false,
|
||||
"transmit": false,
|
||||
"typeahead_helper": false,
|
||||
"typing_events": false,
|
||||
|
|
|
@ -34,7 +34,7 @@ const overlays = set_global("overlays", {});
|
|||
const settings = set_global("settings", {});
|
||||
const subs = set_global("subs", {});
|
||||
const ui_util = set_global("ui_util", {});
|
||||
set_global("top_left_corner", {
|
||||
rewiremock("../../static/js/top_left_corner").with({
|
||||
handle_narrow_deactivated: () => {},
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ set_global("page_params", {});
|
|||
const search = set_global("search", {});
|
||||
const stream_list = set_global("stream_list", {});
|
||||
const message_view_header = set_global("message_view_header", {});
|
||||
const top_left_corner = set_global("top_left_corner", {});
|
||||
const top_left_corner = {__esModule: true};
|
||||
rewiremock("../../static/js/top_left_corner").with(top_left_corner);
|
||||
const typing_events = set_global("typing_events", {});
|
||||
const ui_util = set_global("ui_util", {});
|
||||
const unread_ops = set_global("unread_ops", {});
|
||||
|
|
|
@ -10,7 +10,7 @@ const {run_test} = require("../zjsunit/test");
|
|||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
set_global("top_left_corner", {
|
||||
rewiremock("../../static/js/top_left_corner").with({
|
||||
narrow_to_recent_topics: noop,
|
||||
});
|
||||
set_global("stream_list", {
|
||||
|
|
|
@ -131,7 +131,6 @@ zrequire("search");
|
|||
zrequire("notifications");
|
||||
zrequire("stream_list");
|
||||
zrequire("sent_messages");
|
||||
zrequire("top_left_corner");
|
||||
zrequire("starred_messages");
|
||||
zrequire("recent_topics");
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import "../input_pill";
|
|||
import "../setup";
|
||||
import "../unread_ops";
|
||||
import "../unread";
|
||||
import "../top_left_corner";
|
||||
import "../stream_list";
|
||||
import "../filter";
|
||||
import "../poll_widget";
|
||||
|
|
|
@ -111,7 +111,6 @@ declare let subs: any;
|
|||
declare let message_view_header: any;
|
||||
declare let timerender: any;
|
||||
declare let stream_topic_history: any;
|
||||
declare let top_left_corner: any;
|
||||
declare let transmit: any;
|
||||
declare let typeahead_helper: any;
|
||||
declare let typing_events: any;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
const drafts = require("./drafts");
|
||||
const invite = require("./invite");
|
||||
const message_viewport = require("./message_viewport");
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
|
||||
// Read https://zulip.readthedocs.io/en/latest/subsystems/hashchange-system.html
|
||||
// or locally: docs/subsystems/hashchange-system.md
|
||||
|
|
|
@ -4,6 +4,7 @@ const channel = require("./channel");
|
|||
const {MessageListData} = require("./message_list_data");
|
||||
const people = require("./people");
|
||||
const search_pill = require("./search_pill");
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
const topic_generator = require("./topic_generator");
|
||||
const util = require("./util");
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ const {localstorage} = require("./localstorage");
|
|||
const muting = require("./muting");
|
||||
const people = require("./people");
|
||||
const recent_senders = require("./recent_senders");
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
|
||||
const topics = new Map(); // Key is stream-id:topic.
|
||||
let topics_widget;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
|
||||
exports.starred_ids = new Set();
|
||||
|
||||
exports.initialize = function () {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
"use strict";
|
||||
import * as people from "./people";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as unread_ui from "./unread_ui";
|
||||
|
||||
const people = require("./people");
|
||||
const pm_list = require("./pm_list");
|
||||
const unread_ui = require("./unread_ui");
|
||||
|
||||
exports.update_count_in_dom = function (unread_count_elem, count) {
|
||||
export function update_count_in_dom(unread_count_elem, count) {
|
||||
const count_span = unread_count_elem.find(".count");
|
||||
const value_span = count_span.find(".value");
|
||||
|
||||
|
@ -16,25 +14,25 @@ exports.update_count_in_dom = function (unread_count_elem, count) {
|
|||
|
||||
count_span.show();
|
||||
value_span.text(count);
|
||||
};
|
||||
}
|
||||
|
||||
exports.update_starred_count = function (count) {
|
||||
export function update_starred_count(count) {
|
||||
const starred_li = $(".top_left_starred_messages");
|
||||
exports.update_count_in_dom(starred_li, count);
|
||||
};
|
||||
update_count_in_dom(starred_li, count);
|
||||
}
|
||||
|
||||
exports.update_dom_with_unread_counts = function (counts) {
|
||||
export function update_dom_with_unread_counts(counts) {
|
||||
// Note that "Private messages" counts are handled in pm_list.js.
|
||||
|
||||
// mentioned/home have simple integer counts
|
||||
const mentioned_li = $(".top_left_mentions");
|
||||
const home_li = $(".top_left_all_messages");
|
||||
|
||||
exports.update_count_in_dom(mentioned_li, counts.mentioned_message_count);
|
||||
exports.update_count_in_dom(home_li, counts.home_unread_messages);
|
||||
update_count_in_dom(mentioned_li, counts.mentioned_message_count);
|
||||
update_count_in_dom(home_li, counts.home_unread_messages);
|
||||
|
||||
unread_ui.animate_mention_changes(mentioned_li, counts.mentioned_message_count);
|
||||
};
|
||||
}
|
||||
|
||||
function remove(elem) {
|
||||
elem.removeClass("active-filter active-sub-filter");
|
||||
|
@ -69,7 +67,7 @@ function should_expand_pm_list(filter) {
|
|||
return has_valid_emails;
|
||||
}
|
||||
|
||||
exports.handle_narrow_activated = function (filter) {
|
||||
export function handle_narrow_activated(filter) {
|
||||
deselect_top_left_corner_items();
|
||||
|
||||
let ops;
|
||||
|
@ -102,17 +100,17 @@ exports.handle_narrow_activated = function (filter) {
|
|||
} else {
|
||||
pm_list.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.handle_narrow_deactivated = function () {
|
||||
export function handle_narrow_deactivated() {
|
||||
deselect_top_left_corner_items();
|
||||
pm_list.close();
|
||||
|
||||
const filter_li = $(".top_left_all_messages");
|
||||
filter_li.addClass("active-filter");
|
||||
};
|
||||
}
|
||||
|
||||
exports.narrow_to_recent_topics = function () {
|
||||
export function narrow_to_recent_topics() {
|
||||
remove($(".top_left_all_messages"));
|
||||
remove($(".top_left_private_messages"));
|
||||
remove($(".top_left_starred_messages"));
|
||||
|
@ -122,6 +120,4 @@ exports.narrow_to_recent_topics = function () {
|
|||
setTimeout(() => {
|
||||
resize.resize_stream_filters_container();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
window.top_left_corner = exports;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as pm_list from "./pm_list";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as topic_list from "./topic_list";
|
||||
|
||||
let last_mention_count = 0;
|
||||
|
|
Loading…
Reference in New Issue