mirror of https://github.com/zulip/zulip.git
js: Convert static/js/narrow.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
7a67c06581
commit
e74598da17
|
@ -141,7 +141,6 @@
|
|||
"localStorage": false,
|
||||
"location": false,
|
||||
"message_events": false,
|
||||
"narrow": false,
|
||||
"page_params": false,
|
||||
"pointer": false,
|
||||
"realm_night_logo": false,
|
||||
|
|
|
@ -32,7 +32,8 @@ const info_overlay = {__esModule: true};
|
|||
rewiremock("../../static/js/info_overlay").with(info_overlay);
|
||||
const message_viewport = {__esModule: true};
|
||||
rewiremock("../../static/js/message_viewport").with(message_viewport);
|
||||
const narrow = set_global("narrow", {});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
const overlays = {__esModule: true};
|
||||
rewiremock("../../static/js/overlays").with(overlays);
|
||||
const settings = {__esModule: true};
|
||||
|
|
|
@ -93,7 +93,8 @@ const message_edit = {__esModule: true};
|
|||
rewiremock("../../static/js/message_edit").with(message_edit);
|
||||
const muting_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/muting_ui").with(muting_ui);
|
||||
const narrow = set_global("narrow", {});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
const navigate = {__esModule: true};
|
||||
rewiremock("../../static/js/navigate").with(navigate);
|
||||
const reactions = {__esModule: true};
|
||||
|
|
|
@ -46,7 +46,6 @@ rewiremock("clipboard").with(ClipboardJS);
|
|||
|
||||
rewiremock.enable();
|
||||
|
||||
zrequire("narrow");
|
||||
const people = zrequire("people");
|
||||
const user_status = zrequire("user_status");
|
||||
const message_edit = zrequire("message_edit");
|
||||
|
|
|
@ -19,7 +19,7 @@ rewiremock("../../static/js/stream_list").with({
|
|||
set_global("compose_actions", {
|
||||
cancel: noop,
|
||||
});
|
||||
set_global("narrow", {
|
||||
rewiremock("../../static/js/narrow").with({
|
||||
set_narrow_title: noop,
|
||||
});
|
||||
rewiremock("../../static/js/message_view_header").with({
|
||||
|
|
|
@ -25,7 +25,8 @@ rewiremock("../../static/js/ui_util").with({
|
|||
change_tab_to: noop,
|
||||
place_caret_at_end: noop,
|
||||
});
|
||||
const narrow = set_global("narrow", {});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
rewiremock("../../static/js/search_pill_widget").with({
|
||||
widget: {
|
||||
getByID: () => true,
|
||||
|
|
|
@ -21,7 +21,8 @@ rewiremock("../../static/js/search_suggestion").with(search_suggestion);
|
|||
rewiremock("../../static/js/ui_util").with({
|
||||
change_tab_to: noop,
|
||||
});
|
||||
const narrow = set_global("narrow", {});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
const Filter = {};
|
||||
|
||||
rewiremock("../../static/js/filter").with({
|
||||
|
|
|
@ -15,7 +15,7 @@ rewiremock("../../static/js/message_store").with({
|
|||
user_ids: () => [],
|
||||
});
|
||||
|
||||
set_global("narrow", {});
|
||||
rewiremock("../../static/js/narrow").with({});
|
||||
|
||||
rewiremock.enable();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const page_params = set_global("page_params", {
|
|||
rewiremock("../../static/js/message_store").with({
|
||||
user_ids: () => [],
|
||||
});
|
||||
set_global("narrow", {});
|
||||
rewiremock("../../static/js/narrow").with({});
|
||||
|
||||
rewiremock.enable();
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ const recent_senders = zrequire("recent_senders");
|
|||
const peer_data = zrequire("peer_data");
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
zrequire("narrow");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
const pygments_data = zrequire("pygments_data", "generated/pygments_data.json");
|
||||
|
|
|
@ -114,7 +114,6 @@ const util = zrequire("util");
|
|||
const upload = zrequire("upload");
|
||||
const compose = zrequire("compose");
|
||||
zrequire("composebox_typeahead");
|
||||
zrequire("narrow");
|
||||
|
||||
run_test("initialize_everything", () => {
|
||||
util.is_mobile = () => false;
|
||||
|
|
|
@ -5,6 +5,7 @@ import {buddy_list} from "./buddy_list";
|
|||
import * as channel from "./channel";
|
||||
import * as keydown_util from "./keydown_util";
|
||||
import {ListCursor} from "./list_cursor";
|
||||
import * as narrow from "./narrow";
|
||||
import * as people from "./people";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as popovers from "./popovers";
|
||||
|
|
|
@ -17,7 +17,6 @@ import "../i18n";
|
|||
import "../fold_dict";
|
||||
import "../setup";
|
||||
import "../message_list";
|
||||
import "../narrow";
|
||||
import "../reload";
|
||||
import "../compose_actions";
|
||||
import "../subs";
|
||||
|
|
|
@ -20,6 +20,7 @@ import * as message_edit_history from "./message_edit_history";
|
|||
import * as message_flags from "./message_flags";
|
||||
import * as message_store from "./message_store";
|
||||
import * as muting_ui from "./muting_ui";
|
||||
import * as narrow from "./narrow";
|
||||
import * as notifications from "./notifications";
|
||||
import * as overlays from "./overlays";
|
||||
import * as popovers from "./popovers";
|
||||
|
|
|
@ -10,6 +10,7 @@ import * as compose_ui from "./compose_ui";
|
|||
import * as hashchange from "./hashchange";
|
||||
import {localstorage} from "./localstorage";
|
||||
import * as markdown from "./markdown";
|
||||
import * as narrow from "./narrow";
|
||||
import * as overlays from "./overlays";
|
||||
import * as people from "./people";
|
||||
import * as stream_color from "./stream_color";
|
||||
|
|
|
@ -13,7 +13,6 @@ declare let favicon: any;
|
|||
declare let home_msg_list: any;
|
||||
declare let i18n: any;
|
||||
declare let message_events: any;
|
||||
declare let narrow: any;
|
||||
declare let page_params: any;
|
||||
declare let pointer: any;
|
||||
declare let settings_profile_fields: any;
|
||||
|
|
|
@ -5,6 +5,7 @@ import * as hash_util from "./hash_util";
|
|||
import * as info_overlay from "./info_overlay";
|
||||
import * as invite from "./invite";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as narrow from "./narrow";
|
||||
import * as navigate from "./navigate";
|
||||
import * as overlays from "./overlays";
|
||||
import * as recent_topics from "./recent_topics";
|
||||
|
|
|
@ -18,6 +18,7 @@ import * as message_edit from "./message_edit";
|
|||
import * as message_flags from "./message_flags";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
import * as muting_ui from "./muting_ui";
|
||||
import * as narrow from "./narrow";
|
||||
import * as navigate from "./navigate";
|
||||
import * as overlays from "./overlays";
|
||||
import * as popovers from "./popovers";
|
||||
|
|
|
@ -11,6 +11,7 @@ const message_edit_history = require("./message_edit_history");
|
|||
const message_list = require("./message_list");
|
||||
const message_store = require("./message_store");
|
||||
const message_util = require("./message_util");
|
||||
const narrow = require("./narrow");
|
||||
const narrow_state = require("./narrow_state");
|
||||
const notifications = require("./notifications");
|
||||
const pm_list = require("./pm_list");
|
||||
|
|
|
@ -5,6 +5,7 @@ import * as message_list from "./message_list";
|
|||
import * as message_scroll from "./message_scroll";
|
||||
import * as message_store from "./message_store";
|
||||
import * as message_util from "./message_util";
|
||||
import * as narrow from "./narrow";
|
||||
import * as people from "./people";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as recent_topics from "./recent_topics";
|
||||
|
|
|
@ -2,6 +2,7 @@ import autosize from "autosize";
|
|||
|
||||
import {MessageListData} from "./message_list_data";
|
||||
import {MessageListView} from "./message_list_view";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as stream_data from "./stream_data";
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import * as hash_util from "./hash_util";
|
|||
import * as loading from "./loading";
|
||||
import * as message_fetch from "./message_fetch";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as recent_topics from "./recent_topics";
|
||||
import * as unread_ops from "./unread_ops";
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
const channel = require("./channel");
|
||||
const compose = require("./compose");
|
||||
const compose_fade = require("./compose_fade");
|
||||
const compose_state = require("./compose_state");
|
||||
const condense = require("./condense");
|
||||
const {Filter} = require("./filter");
|
||||
const hashchange = require("./hashchange");
|
||||
const message_edit = require("./message_edit");
|
||||
const message_fetch = require("./message_fetch");
|
||||
const message_list = require("./message_list");
|
||||
const {MessageListData} = require("./message_list_data");
|
||||
const message_scroll = require("./message_scroll");
|
||||
const message_store = require("./message_store");
|
||||
const message_view_header = require("./message_view_header");
|
||||
const narrow_state = require("./narrow_state");
|
||||
const notifications = require("./notifications");
|
||||
const people = require("./people");
|
||||
const recent_topics = require("./recent_topics");
|
||||
const resize = require("./resize");
|
||||
const search = require("./search");
|
||||
const search_pill = require("./search_pill");
|
||||
const search_pill_widget = require("./search_pill_widget");
|
||||
const stream_data = require("./stream_data");
|
||||
const stream_list = require("./stream_list");
|
||||
const stream_topic_history = require("./stream_topic_history");
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
const topic_generator = require("./topic_generator");
|
||||
const typing_events = require("./typing_events");
|
||||
const ui_util = require("./ui_util");
|
||||
const unread = require("./unread");
|
||||
const unread_ops = require("./unread_ops");
|
||||
const util = require("./util");
|
||||
const widgetize = require("./widgetize");
|
||||
import * as channel from "./channel";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as compose_state from "./compose_state";
|
||||
import * as condense from "./condense";
|
||||
import {Filter} from "./filter";
|
||||
import * as hashchange from "./hashchange";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_fetch from "./message_fetch";
|
||||
import * as message_list from "./message_list";
|
||||
import {MessageListData} from "./message_list_data";
|
||||
import * as message_scroll from "./message_scroll";
|
||||
import * as message_store from "./message_store";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as notifications from "./notifications";
|
||||
import * as people from "./people";
|
||||
import * as recent_topics from "./recent_topics";
|
||||
import * as resize from "./resize";
|
||||
import * as search from "./search";
|
||||
import * as search_pill from "./search_pill";
|
||||
import * as search_pill_widget from "./search_pill_widget";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_list from "./stream_list";
|
||||
import * as stream_topic_history from "./stream_topic_history";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as topic_generator from "./topic_generator";
|
||||
import * as typing_events from "./typing_events";
|
||||
import * as ui_util from "./ui_util";
|
||||
import * as unread from "./unread";
|
||||
import * as unread_ops from "./unread_ops";
|
||||
import * as util from "./util";
|
||||
import * as widgetize from "./widgetize";
|
||||
|
||||
let unnarrow_times;
|
||||
|
||||
|
@ -88,7 +86,7 @@ function report_unnarrow_time() {
|
|||
unnarrow_times = {};
|
||||
}
|
||||
|
||||
exports.save_pre_narrow_offset_for_reload = function () {
|
||||
export function save_pre_narrow_offset_for_reload() {
|
||||
if (current_msg_list.selected_id() !== -1) {
|
||||
if (current_msg_list.selected_row().length === 0) {
|
||||
blueslip.debug("narrow.activate missing selected row", {
|
||||
|
@ -103,14 +101,14 @@ exports.save_pre_narrow_offset_for_reload = function () {
|
|||
}
|
||||
current_msg_list.pre_narrow_offset = current_msg_list.selected_row().offset().top;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.narrow_title = "home";
|
||||
export let narrow_title = "home";
|
||||
|
||||
exports.set_narrow_title = function (title) {
|
||||
exports.narrow_title = title;
|
||||
export function set_narrow_title(title) {
|
||||
narrow_title = title;
|
||||
notifications.redraw_title();
|
||||
};
|
||||
}
|
||||
|
||||
function update_narrow_title(filter) {
|
||||
// Take the most detailed part of the narrow to use as the title.
|
||||
|
@ -118,34 +116,34 @@ function update_narrow_title(filter) {
|
|||
// "is", we shouldn't update the narrow title
|
||||
if (filter.has_operator("stream")) {
|
||||
if (filter.has_operator("topic")) {
|
||||
exports.set_narrow_title(filter.operands("topic")[0]);
|
||||
set_narrow_title(filter.operands("topic")[0]);
|
||||
} else {
|
||||
exports.set_narrow_title(filter.operands("stream")[0]);
|
||||
set_narrow_title(filter.operands("stream")[0]);
|
||||
}
|
||||
} else if (filter.has_operator("is")) {
|
||||
const title = filter.operands("is")[0];
|
||||
exports.set_narrow_title(title.charAt(0).toUpperCase() + title.slice(1) + " messages");
|
||||
set_narrow_title(title.charAt(0).toUpperCase() + title.slice(1) + " messages");
|
||||
} else if (filter.has_operator("pm-with") || filter.has_operator("group-pm-with")) {
|
||||
const emails = filter.public_operators()[0].operand;
|
||||
const user_ids = people.emails_strings_to_user_ids_string(emails);
|
||||
if (user_ids !== undefined) {
|
||||
const names = people.get_recipients(user_ids);
|
||||
if (filter.has_operator("pm-with")) {
|
||||
exports.set_narrow_title(names);
|
||||
set_narrow_title(names);
|
||||
} else {
|
||||
exports.set_narrow_title(names + " and others");
|
||||
set_narrow_title(names + " and others");
|
||||
}
|
||||
} else {
|
||||
if (emails.includes(",")) {
|
||||
exports.set_narrow_title("Invalid users");
|
||||
set_narrow_title("Invalid users");
|
||||
} else {
|
||||
exports.set_narrow_title("Invalid user");
|
||||
set_narrow_title("Invalid user");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.activate = function (raw_operators, opts) {
|
||||
export function activate(raw_operators, opts) {
|
||||
/* Main entrypoint for switching to a new view / message list.
|
||||
Note that for historical reasons related to the current
|
||||
client-side caching structure, the "All messages"/home_msg_list
|
||||
|
@ -196,7 +194,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
$(".tooltip").hide();
|
||||
|
||||
if (raw_operators.length === 0) {
|
||||
exports.deactivate();
|
||||
deactivate();
|
||||
return;
|
||||
}
|
||||
const filter = new Filter(raw_operators);
|
||||
|
@ -260,7 +258,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
const excludes_muted_topics = narrow_state.excludes_muted_topics();
|
||||
|
||||
// Save how far from the pointer the top of the message list was.
|
||||
exports.save_pre_narrow_offset_for_reload();
|
||||
save_pre_narrow_offset_for_reload();
|
||||
|
||||
let msg_data = new MessageListData({
|
||||
filter: narrow_state.filter(),
|
||||
|
@ -271,7 +269,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
// with no backend help) and we have the message we want to select.
|
||||
// Also update id_info accordingly.
|
||||
// original back.
|
||||
exports.maybe_add_local_messages({
|
||||
maybe_add_local_messages({
|
||||
id_info,
|
||||
msg_data,
|
||||
});
|
||||
|
@ -339,7 +337,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
anchor,
|
||||
cont() {
|
||||
if (!select_immediately) {
|
||||
exports.update_selection({
|
||||
update_selection({
|
||||
id_info,
|
||||
select_offset: then_select_offset,
|
||||
});
|
||||
|
@ -351,7 +349,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
})();
|
||||
|
||||
if (select_immediately) {
|
||||
exports.update_selection({
|
||||
update_selection({
|
||||
id_info,
|
||||
select_offset: then_select_offset,
|
||||
});
|
||||
|
@ -396,7 +394,7 @@ exports.activate = function (raw_operators, opts) {
|
|||
msg_list.initial_free_time = new Date();
|
||||
maybe_report_narrow_time(msg_list);
|
||||
}, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function min_defined(a, b) {
|
||||
if (a === undefined) {
|
||||
|
@ -420,7 +418,7 @@ function load_local_messages(msg_data) {
|
|||
return !msg_data.empty();
|
||||
}
|
||||
|
||||
exports.maybe_add_local_messages = function (opts) {
|
||||
export function maybe_add_local_messages(opts) {
|
||||
// This function determines whether we need to go to the server to
|
||||
// fetch messages for the requested narrow, or whether we have the
|
||||
// data cached locally to render the narrow correctly without
|
||||
|
@ -574,9 +572,9 @@ exports.maybe_add_local_messages = function (opts) {
|
|||
// !can_apply_locally + target_id is a rare combination in the
|
||||
// first place, so we don't bother.
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
exports.update_selection = function (opts) {
|
||||
export function update_selection(opts) {
|
||||
if (message_list.narrowed.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -607,15 +605,15 @@ exports.update_selection = function (opts) {
|
|||
message_list.narrowed.view.set_message_offset(select_offset);
|
||||
}
|
||||
unread_ops.process_visible();
|
||||
};
|
||||
}
|
||||
|
||||
exports.activate_stream_for_cycle_hotkey = function (stream_name) {
|
||||
export function activate_stream_for_cycle_hotkey(stream_name) {
|
||||
// This is the common code for A/D hotkeys.
|
||||
const filter_expr = [{operator: "stream", operand: stream_name}];
|
||||
exports.activate(filter_expr, {});
|
||||
};
|
||||
activate(filter_expr, {});
|
||||
}
|
||||
|
||||
exports.stream_cycle_backward = function () {
|
||||
export function stream_cycle_backward() {
|
||||
const curr_stream = narrow_state.stream();
|
||||
|
||||
if (!curr_stream) {
|
||||
|
@ -628,10 +626,10 @@ exports.stream_cycle_backward = function () {
|
|||
return;
|
||||
}
|
||||
|
||||
exports.activate_stream_for_cycle_hotkey(stream_name);
|
||||
};
|
||||
activate_stream_for_cycle_hotkey(stream_name);
|
||||
}
|
||||
|
||||
exports.stream_cycle_forward = function () {
|
||||
export function stream_cycle_forward() {
|
||||
const curr_stream = narrow_state.stream();
|
||||
|
||||
if (!curr_stream) {
|
||||
|
@ -644,10 +642,10 @@ exports.stream_cycle_forward = function () {
|
|||
return;
|
||||
}
|
||||
|
||||
exports.activate_stream_for_cycle_hotkey(stream_name);
|
||||
};
|
||||
activate_stream_for_cycle_hotkey(stream_name);
|
||||
}
|
||||
|
||||
exports.narrow_to_next_topic = function () {
|
||||
export function narrow_to_next_topic() {
|
||||
const curr_info = {
|
||||
stream: narrow_state.stream(),
|
||||
topic: narrow_state.topic(),
|
||||
|
@ -664,10 +662,10 @@ exports.narrow_to_next_topic = function () {
|
|||
{operator: "topic", operand: next_narrow.topic},
|
||||
];
|
||||
|
||||
exports.activate(filter_expr, {});
|
||||
};
|
||||
activate(filter_expr, {});
|
||||
}
|
||||
|
||||
exports.narrow_to_next_pm_string = function () {
|
||||
export function narrow_to_next_pm_string() {
|
||||
const curr_pm = narrow_state.pm_string();
|
||||
|
||||
const next_pm = topic_generator.get_next_unread_pm_string(curr_pm);
|
||||
|
@ -687,22 +685,22 @@ exports.narrow_to_next_pm_string = function () {
|
|||
force_close: true,
|
||||
};
|
||||
|
||||
exports.activate(filter_expr, opts);
|
||||
};
|
||||
activate(filter_expr, opts);
|
||||
}
|
||||
|
||||
// Activate narrowing with a single operator.
|
||||
// This is just for syntactic convenience.
|
||||
exports.by = function (operator, operand, opts) {
|
||||
exports.activate([{operator, operand}], opts);
|
||||
};
|
||||
export function by(operator, operand, opts) {
|
||||
activate([{operator, operand}], opts);
|
||||
}
|
||||
|
||||
exports.by_topic = function (target_id, opts) {
|
||||
export function by_topic(target_id, opts) {
|
||||
// don't use current_msg_list as it won't work for muted messages or for out-of-narrow links
|
||||
const original = message_store.get(target_id);
|
||||
if (original.type !== "stream") {
|
||||
// Only stream messages have topics, but the
|
||||
// user wants us to narrow in some way.
|
||||
exports.by_recipient(target_id, opts);
|
||||
by_recipient(target_id, opts);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -716,11 +714,11 @@ exports.by_topic = function (target_id, opts) {
|
|||
{operator: "topic", operand: original.topic},
|
||||
];
|
||||
opts = {then_select_id: target_id, ...opts};
|
||||
exports.activate(search_terms, opts);
|
||||
};
|
||||
activate(search_terms, opts);
|
||||
}
|
||||
|
||||
// Called for the 'narrow by stream' hotkey.
|
||||
exports.by_recipient = function (target_id, opts) {
|
||||
export function by_recipient(target_id, opts) {
|
||||
opts = {then_select_id: target_id, ...opts};
|
||||
// don't use current_msg_list as it won't work for muted messages or for out-of-narrow links
|
||||
const message = message_store.get(target_id);
|
||||
|
@ -732,17 +730,17 @@ exports.by_recipient = function (target_id, opts) {
|
|||
|
||||
switch (message.type) {
|
||||
case "private":
|
||||
exports.by("pm-with", message.reply_to, opts);
|
||||
by("pm-with", message.reply_to, opts);
|
||||
break;
|
||||
|
||||
case "stream":
|
||||
exports.by("stream", message.stream, opts);
|
||||
by("stream", message.stream, opts);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Called by the narrow_to_compose_target hotkey.
|
||||
exports.to_compose_target = function () {
|
||||
export function to_compose_target() {
|
||||
if (!compose_state.composing()) {
|
||||
return;
|
||||
}
|
||||
|
@ -765,7 +763,7 @@ exports.to_compose_target = function () {
|
|||
if (topics.includes(topic)) {
|
||||
operators.push({operator: "topic", operand: topic});
|
||||
}
|
||||
exports.activate(operators, opts);
|
||||
activate(operators, opts);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -776,12 +774,12 @@ exports.to_compose_target = function () {
|
|||
// If there are no recipients or any recipient is
|
||||
// invalid, narrow to all PMs.
|
||||
if (emails.length === 0 || invalid.length > 0) {
|
||||
exports.by("is", "private", opts);
|
||||
by("is", "private", opts);
|
||||
return;
|
||||
}
|
||||
exports.by("pm-with", util.normalize_recipients(recipient_string), opts);
|
||||
by("pm-with", util.normalize_recipients(recipient_string), opts);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function handle_post_narrow_deactivate_processes() {
|
||||
compose_fade.update_message_list();
|
||||
|
@ -798,13 +796,13 @@ function handle_post_narrow_deactivate_processes() {
|
|||
widgetize.set_widgets_for_list();
|
||||
typing_events.render_notifications_for_narrow();
|
||||
message_view_header.initialize();
|
||||
exports.narrow_title = "All messages";
|
||||
narrow_title = "All messages";
|
||||
notifications.redraw_title();
|
||||
message_scroll.hide_top_of_narrow_notices();
|
||||
message_scroll.update_top_of_narrow_notices(home_msg_list);
|
||||
}
|
||||
|
||||
exports.deactivate = function (coming_from_recent_topics = false) {
|
||||
export function deactivate(coming_from_recent_topics = false) {
|
||||
// NOTE: Never call this function independently,
|
||||
// always use hashchange.go_to_location("#all_messages") to
|
||||
// activate All message narrow.
|
||||
|
@ -833,7 +831,7 @@ exports.deactivate = function (coming_from_recent_topics = false) {
|
|||
// There is no way to intercept in-flight scroll events, and they will
|
||||
// cause you to end up in the wrong place if you are actively scrolling
|
||||
// on an unnarrow. Wait a bit and try again once the scrolling is over.
|
||||
setTimeout(exports.deactivate, 50);
|
||||
setTimeout(deactivate, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -843,7 +841,7 @@ exports.deactivate = function (coming_from_recent_topics = false) {
|
|||
|
||||
narrow_state.reset_current_filter();
|
||||
|
||||
exports.hide_empty_narrow_message();
|
||||
hide_empty_narrow_message();
|
||||
|
||||
$("body").removeClass("narrowed_view");
|
||||
$("#zfilt").removeClass("focused_table");
|
||||
|
@ -897,7 +895,7 @@ exports.deactivate = function (coming_from_recent_topics = false) {
|
|||
unnarrow_times.initial_free_time = new Date();
|
||||
report_unnarrow_time();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function set_invalid_narrow_message(invalid_narrow_message) {
|
||||
const search_string_display = $("#empty_search_stop_words_string");
|
||||
|
@ -1067,7 +1065,7 @@ function pick_empty_narrow_banner() {
|
|||
return default_banner;
|
||||
}
|
||||
|
||||
exports.show_empty_narrow_message = function () {
|
||||
export function show_empty_narrow_message() {
|
||||
$(".empty_feed_notice").hide();
|
||||
pick_empty_narrow_banner().show();
|
||||
$("#left_bar_compose_reply_button_big").attr(
|
||||
|
@ -1075,12 +1073,10 @@ exports.show_empty_narrow_message = function () {
|
|||
i18n.t("There are no messages to reply to."),
|
||||
);
|
||||
$("#left_bar_compose_reply_button_big").prop("disabled", true);
|
||||
};
|
||||
}
|
||||
|
||||
exports.hide_empty_narrow_message = function () {
|
||||
export function hide_empty_narrow_message() {
|
||||
$(".empty_feed_notice").hide();
|
||||
$("#left_bar_compose_reply_button_big").attr("title", i18n.t("Reply (r)"));
|
||||
$("#left_bar_compose_reply_button_big").prop("disabled", false);
|
||||
};
|
||||
|
||||
window.narrow = exports;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import * as channel from "./channel";
|
|||
import * as favicon from "./favicon";
|
||||
import * as message_store from "./message_store";
|
||||
import * as muting from "./muting";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as navigate from "./navigate";
|
||||
import * as people from "./people";
|
||||
|
|
|
@ -26,6 +26,7 @@ import * as message_edit_history from "./message_edit_history";
|
|||
import * as message_viewport from "./message_viewport";
|
||||
import * as muting from "./muting";
|
||||
import * as muting_ui from "./muting_ui";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as overlays from "./overlays";
|
||||
import * as people from "./people";
|
||||
|
|
|
@ -10,6 +10,7 @@ import * as message_store from "./message_store";
|
|||
import * as message_util from "./message_util";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
import * as muting from "./muting";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as navigate from "./navigate";
|
||||
import * as panels from "./panels";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {Filter} from "./filter";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as search_pill from "./search_pill";
|
||||
import * as search_pill_widget from "./search_pill_widget";
|
||||
|
|
|
@ -6,6 +6,7 @@ import render_stream_sidebar_row from "../templates/stream_sidebar_row.hbs";
|
|||
import * as hash_util from "./hash_util";
|
||||
import * as keydown_util from "./keydown_util";
|
||||
import {ListCursor} from "./list_cursor";
|
||||
import * as narrow from "./narrow";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as popovers from "./popovers";
|
||||
import * as resize from "./resize";
|
||||
|
|
|
@ -13,6 +13,7 @@ import * as message_edit from "./message_edit";
|
|||
import * as message_flags from "./message_flags";
|
||||
import * as muting from "./muting";
|
||||
import * as muting_ui from "./muting_ui";
|
||||
import * as narrow from "./narrow";
|
||||
import * as popovers from "./popovers";
|
||||
import * as resize from "./resize";
|
||||
import * as stream_color from "./stream_color";
|
||||
|
|
|
@ -4,6 +4,7 @@ import render_more_topics from "../templates/more_topics.hbs";
|
|||
import render_more_topics_spinner from "../templates/more_topics_spinner.hbs";
|
||||
import render_topic_list_item from "../templates/topic_list_item.hbs";
|
||||
|
||||
import * as narrow from "./narrow";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_popover from "./stream_popover";
|
||||
import * as stream_topic_history from "./stream_topic_history";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as channel from "./channel";
|
||||
import * as narrow from "./narrow";
|
||||
|
||||
function set_tutorial_status(status, callback) {
|
||||
return channel.post({
|
||||
|
|
Loading…
Reference in New Issue