mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
narrow: Rename activate to show.
This make the main call which displays message list sound similar to `recent_view.show` and `inbox_ui.show`.
This commit is contained in:
@@ -24,7 +24,7 @@ function restore_draft(draft_id) {
|
|||||||
|
|
||||||
if (compose_args.type === "stream") {
|
if (compose_args.type === "stream") {
|
||||||
if (draft.stream_id !== undefined && draft.topic !== "") {
|
if (draft.stream_id !== undefined && draft.topic !== "") {
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "channel",
|
operator: "channel",
|
||||||
@@ -37,7 +37,7 @@ function restore_draft(draft_id) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (compose_args.private_message_recipient !== "") {
|
if (compose_args.private_message_recipient !== "") {
|
||||||
narrow.activate([{operator: "dm", operand: compose_args.private_message_recipient}], {
|
narrow.show([{operator: "dm", operand: compose_args.private_message_recipient}], {
|
||||||
trigger: "restore draft",
|
trigger: "restore draft",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function show_all_message_view() {
|
|||||||
// Don't export this function outside of this module since
|
// Don't export this function outside of this module since
|
||||||
// `change_hash` is false here which means it is should only
|
// `change_hash` is false here which means it is should only
|
||||||
// be called after hash is updated in the URL.
|
// be called after hash is updated in the URL.
|
||||||
narrow.activate([{operator: "in", operand: "home"}], {
|
narrow.show([{operator: "in", operand: "home"}], {
|
||||||
trigger: "hashchange",
|
trigger: "hashchange",
|
||||||
change_hash: false,
|
change_hash: false,
|
||||||
then_select_id: history.state?.narrow_pointer,
|
then_select_id: history.state?.narrow_pointer,
|
||||||
@@ -198,7 +198,7 @@ function do_hashchange_normal(from_reload) {
|
|||||||
narrow_opts.then_select_offset = data_for_hash.narrow_offset;
|
narrow_opts.then_select_offset = data_for_hash.narrow_offset;
|
||||||
narrow_opts.show_more_topics = data_for_hash.show_more_topics ?? false;
|
narrow_opts.show_more_topics = data_for_hash.show_more_topics ?? false;
|
||||||
}
|
}
|
||||||
narrow.activate(terms, narrow_opts);
|
narrow.show(terms, narrow_opts);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "":
|
case "":
|
||||||
|
|||||||
@@ -925,7 +925,7 @@ export function process_hotkey(e, hotkey) {
|
|||||||
// Shortcuts that don't require a message
|
// Shortcuts that don't require a message
|
||||||
switch (event_name) {
|
switch (event_name) {
|
||||||
case "narrow_private":
|
case "narrow_private":
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "is",
|
operator: "is",
|
||||||
@@ -1194,10 +1194,10 @@ export function process_hotkey(e, hotkey) {
|
|||||||
case "zoom_to_message_near": {
|
case "zoom_to_message_near": {
|
||||||
// The following code is essentially equivalent to
|
// The following code is essentially equivalent to
|
||||||
// `window.location = hashutil.by_conversation_and_time_url(msg)`
|
// `window.location = hashutil.by_conversation_and_time_url(msg)`
|
||||||
// but we use `narrow.activate` to pass in the `trigger` parameter
|
// but we use `narrow.show` to pass in the `trigger` parameter
|
||||||
switch (msg.type) {
|
switch (msg.type) {
|
||||||
case "private":
|
case "private":
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{operator: "dm", operand: msg.reply_to},
|
{operator: "dm", operand: msg.reply_to},
|
||||||
{operator: "near", operand: msg.id},
|
{operator: "near", operand: msg.id},
|
||||||
@@ -1206,7 +1206,7 @@ export function process_hotkey(e, hotkey) {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
case "stream":
|
case "stream":
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "channel",
|
operator: "channel",
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ export function update_messages(events) {
|
|||||||
trigger: "stream/topic change",
|
trigger: "stream/topic change",
|
||||||
then_select_id: current_selected_id,
|
then_select_id: current_selected_id,
|
||||||
};
|
};
|
||||||
narrow.activate(terms, opts);
|
narrow.show(terms, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ function create_and_update_message_list(filter, id_info, opts) {
|
|||||||
//
|
//
|
||||||
// It's fine for the hash change to happen anytime before updating
|
// It's fine for the hash change to happen anytime before updating
|
||||||
// the current message list as we are trying to emulate the `hashchange`
|
// the current message list as we are trying to emulate the `hashchange`
|
||||||
// workflow we have which calls `narrow.activate` after hash is updated.
|
// workflow we have which calls `narrow.show` after hash is updated.
|
||||||
if (opts.change_hash) {
|
if (opts.change_hash) {
|
||||||
update_hash_to_match_filter(filter, opts.trigger);
|
update_hash_to_match_filter(filter, opts.trigger);
|
||||||
opts.show_more_topics = history.state?.show_more_topics ?? false;
|
opts.show_more_topics = history.state?.show_more_topics ?? false;
|
||||||
@@ -219,7 +219,7 @@ function handle_post_message_list_change(
|
|||||||
compose_recipient.handle_middle_pane_transition();
|
compose_recipient.handle_middle_pane_transition();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activate(raw_terms, opts) {
|
export function show(raw_terms, opts) {
|
||||||
/* Main entry point for switching to a new view / message list.
|
/* Main entry point for switching to a new view / message list.
|
||||||
|
|
||||||
Supported parameters:
|
Supported parameters:
|
||||||
@@ -271,12 +271,12 @@ export function activate(raw_terms, opts) {
|
|||||||
// cause you to end up in the wrong place if you are actively scrolling
|
// 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 likely over.
|
// on an unnarrow. Wait a bit and try again once the scrolling is likely over.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
activate(raw_terms, opts);
|
show(raw_terms, opts);
|
||||||
}, 50);
|
}, 50);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since narrow.activate is called directly from various
|
// Since narrow.show is called directly from various
|
||||||
// places in our code without passing through hashchange,
|
// places in our code without passing through hashchange,
|
||||||
// we need to check if the narrow is allowed for spectator here too.
|
// we need to check if the narrow is allowed for spectator here too.
|
||||||
if (
|
if (
|
||||||
@@ -405,7 +405,7 @@ export function activate(raw_terms, opts) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
activate(adjusted_terms, {
|
show(adjusted_terms, {
|
||||||
...opts,
|
...opts,
|
||||||
// Update the URL fragment to reflect the redirect.
|
// Update the URL fragment to reflect the redirect.
|
||||||
change_hash: true,
|
change_hash: true,
|
||||||
@@ -438,7 +438,7 @@ export function activate(raw_terms, opts) {
|
|||||||
) {
|
) {
|
||||||
const adjusted_terms = adjusted_terms_if_moved(raw_terms, target_message);
|
const adjusted_terms = adjusted_terms_if_moved(raw_terms, target_message);
|
||||||
if (adjusted_terms !== null) {
|
if (adjusted_terms !== null) {
|
||||||
activate(adjusted_terms, {
|
show(adjusted_terms, {
|
||||||
...opts,
|
...opts,
|
||||||
// Update the URL fragment to reflect the redirect.
|
// Update the URL fragment to reflect the redirect.
|
||||||
change_hash: true,
|
change_hash: true,
|
||||||
@@ -456,10 +456,10 @@ export function activate(raw_terms, opts) {
|
|||||||
success(data) {
|
success(data) {
|
||||||
// After the message is fetched, we make the
|
// After the message is fetched, we make the
|
||||||
// message locally available and then call
|
// message locally available and then call
|
||||||
// narrow.activate recursively, setting a flag to
|
// narrow.show recursively, setting a flag to
|
||||||
// indicate we've already done this.
|
// indicate we've already done this.
|
||||||
message_helper.process_new_message(data.message);
|
message_helper.process_new_message(data.message);
|
||||||
activate(raw_terms, {
|
show(raw_terms, {
|
||||||
...opts,
|
...opts,
|
||||||
fetched_target_message: true,
|
fetched_target_message: true,
|
||||||
});
|
});
|
||||||
@@ -470,15 +470,15 @@ export function activate(raw_terms, opts) {
|
|||||||
// happen, for example, if a user types
|
// happen, for example, if a user types
|
||||||
// `stream:foo topic:bar near:1` into the search
|
// `stream:foo topic:bar near:1` into the search
|
||||||
// box. No special rewriting is required, so call
|
// box. No special rewriting is required, so call
|
||||||
// narrow.activate recursively.
|
// narrow.show recursively.
|
||||||
activate(raw_terms, {
|
show(raw_terms, {
|
||||||
fetched_target_message: true,
|
fetched_target_message: true,
|
||||||
...opts,
|
...opts,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// The channel.get will call narrow.activate recursively
|
// The channel.get will call narrow.show recursively
|
||||||
// from a continuation unconditionally; the correct thing
|
// from a continuation unconditionally; the correct thing
|
||||||
// to do here is return.
|
// to do here is return.
|
||||||
return;
|
return;
|
||||||
@@ -487,7 +487,7 @@ export function activate(raw_terms, opts) {
|
|||||||
|
|
||||||
// IMPORTANT: No code that modifies UI state should appear above
|
// IMPORTANT: No code that modifies UI state should appear above
|
||||||
// this point. This is important to prevent calling such functions
|
// this point. This is important to prevent calling such functions
|
||||||
// more than once in the event that we call narrow.activate
|
// more than once in the event that we call narrow.show
|
||||||
// recursively.
|
// recursively.
|
||||||
reset_ui_state(opts);
|
reset_ui_state(opts);
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ export function render_message_list_with_selected_message(opts) {
|
|||||||
export function activate_stream_for_cycle_hotkey(stream_name) {
|
export function activate_stream_for_cycle_hotkey(stream_name) {
|
||||||
// This is the common code for A/D hotkeys.
|
// This is the common code for A/D hotkeys.
|
||||||
const filter_expr = [{operator: "channel", operand: stream_name}];
|
const filter_expr = [{operator: "channel", operand: stream_name}];
|
||||||
activate(filter_expr, {});
|
show(filter_expr, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stream_cycle_backward() {
|
export function stream_cycle_backward() {
|
||||||
@@ -964,7 +964,7 @@ export function narrow_to_next_topic(opts = {}) {
|
|||||||
{operator: "topic", operand: next_narrow.topic},
|
{operator: "topic", operand: next_narrow.topic},
|
||||||
];
|
];
|
||||||
|
|
||||||
activate(filter_expr, opts);
|
show(filter_expr, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function narrow_to_next_pm_string(opts = {}) {
|
export function narrow_to_next_pm_string(opts = {}) {
|
||||||
@@ -994,7 +994,7 @@ export function narrow_to_next_pm_string(opts = {}) {
|
|||||||
force_close: true,
|
force_close: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
activate(filter_expr, updated_opts);
|
show(filter_expr, updated_opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function by_topic(target_id, opts) {
|
export function by_topic(target_id, opts) {
|
||||||
@@ -1024,7 +1024,7 @@ export function by_topic(target_id, opts) {
|
|||||||
{operator: "topic", operand: original.topic},
|
{operator: "topic", operand: original.topic},
|
||||||
];
|
];
|
||||||
opts = {then_select_id: target_id, ...opts};
|
opts = {then_select_id: target_id, ...opts};
|
||||||
activate(search_terms, opts);
|
show(search_terms, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function narrow_by_recipient(target_id, opts) {
|
export function narrow_by_recipient(target_id, opts) {
|
||||||
@@ -1044,7 +1044,7 @@ export function narrow_by_recipient(target_id, opts) {
|
|||||||
// in the new view.
|
// in the new view.
|
||||||
unread_ops.notify_server_message_read(message);
|
unread_ops.notify_server_message_read(message);
|
||||||
}
|
}
|
||||||
activate([{operator: "dm", operand: message.reply_to}], opts);
|
show([{operator: "dm", operand: message.reply_to}], opts);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "stream":
|
case "stream":
|
||||||
@@ -1058,7 +1058,7 @@ export function narrow_by_recipient(target_id, opts) {
|
|||||||
// in the new view.
|
// in the new view.
|
||||||
unread_ops.notify_server_message_read(message);
|
unread_ops.notify_server_message_read(message);
|
||||||
}
|
}
|
||||||
activate(
|
show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "stream",
|
operator: "stream",
|
||||||
@@ -1095,7 +1095,7 @@ export function to_compose_target() {
|
|||||||
if (topic !== "") {
|
if (topic !== "") {
|
||||||
terms.push({operator: "topic", operand: topic});
|
terms.push({operator: "topic", operand: topic});
|
||||||
}
|
}
|
||||||
activate(terms, opts);
|
show(terms, opts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1106,10 +1106,10 @@ export function to_compose_target() {
|
|||||||
// If there are no recipients or any recipient is
|
// If there are no recipients or any recipient is
|
||||||
// invalid, narrow to your direct message feed.
|
// invalid, narrow to your direct message feed.
|
||||||
if (emails.length === 0 || invalid.length > 0) {
|
if (emails.length === 0 || invalid.length > 0) {
|
||||||
activate([{operator: "is", operand: "dm"}], opts);
|
show([{operator: "is", operand: "dm"}], opts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
activate([{operator: "dm", operand: util.normalize_recipients(recipient_string)}], opts);
|
show([{operator: "dm", operand: util.normalize_recipients(recipient_string)}], opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export function initialize() {
|
|||||||
$popper.one("click", ".narrow-self-direct-message", (e) => {
|
$popper.one("click", ".narrow-self-direct-message", (e) => {
|
||||||
const user_id = current_user.user_id;
|
const user_id = current_user.user_id;
|
||||||
const email = people.get_by_user_id(user_id).email;
|
const email = people.get_by_user_id(user_id).email;
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "dm",
|
operator: "dm",
|
||||||
@@ -95,7 +95,7 @@ export function initialize() {
|
|||||||
$popper.one("click", ".narrow-messages-sent", (e) => {
|
$popper.one("click", ".narrow-messages-sent", (e) => {
|
||||||
const user_id = current_user.user_id;
|
const user_id = current_user.user_id;
|
||||||
const email = people.get_by_user_id(user_id).email;
|
const email = people.get_by_user_id(user_id).email;
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "sender",
|
operator: "sender",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function hide_scheduled_message_success_compose_banner(scheduled_message_
|
|||||||
|
|
||||||
function narrow_via_edit_scheduled_message(compose_args) {
|
function narrow_via_edit_scheduled_message(compose_args) {
|
||||||
if (compose_args.message_type === "stream") {
|
if (compose_args.message_type === "stream") {
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "channel",
|
operator: "channel",
|
||||||
@@ -30,7 +30,7 @@ function narrow_via_edit_scheduled_message(compose_args) {
|
|||||||
{trigger: "edit scheduled message"},
|
{trigger: "edit scheduled message"},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
narrow.activate([{operator: "dm", operand: compose_args.private_message_recipient}], {
|
narrow.show([{operator: "dm", operand: compose_args.private_message_recipient}], {
|
||||||
trigger: "edit scheduled message",
|
trigger: "edit scheduled message",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function set_tutorial_status(status, callback) {
|
|||||||
export function initialize() {
|
export function initialize() {
|
||||||
if (page_params.needs_tutorial) {
|
if (page_params.needs_tutorial) {
|
||||||
set_tutorial_status("started");
|
set_tutorial_status("started");
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "is",
|
operator: "is",
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ export function initialize_everything(state_data) {
|
|||||||
const sub = sub_store.get(stream_id);
|
const sub = sub_store.get(stream_id);
|
||||||
sidebar_ui.hide_all();
|
sidebar_ui.hide_all();
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "stream",
|
operator: "stream",
|
||||||
@@ -832,7 +832,7 @@ export function initialize_everything(state_data) {
|
|||||||
compose_textarea.initialize();
|
compose_textarea.initialize();
|
||||||
upload.initialize();
|
upload.initialize();
|
||||||
search.initialize({
|
search.initialize({
|
||||||
on_narrow_search: narrow.activate,
|
on_narrow_search: narrow.show,
|
||||||
});
|
});
|
||||||
desktop_notifications.initialize();
|
desktop_notifications.initialize();
|
||||||
audible_notifications.initialize();
|
audible_notifications.initialize();
|
||||||
@@ -859,7 +859,7 @@ export function initialize_everything(state_data) {
|
|||||||
activity.initialize();
|
activity.initialize();
|
||||||
activity_ui.initialize({
|
activity_ui.initialize({
|
||||||
narrow_by_email(email) {
|
narrow_by_email(email) {
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "dm",
|
operator: "dm",
|
||||||
@@ -886,7 +886,7 @@ export function initialize_everything(state_data) {
|
|||||||
topic_list.initialize({
|
topic_list.initialize({
|
||||||
on_topic_click(stream_id, topic) {
|
on_topic_click(stream_id, topic) {
|
||||||
const sub = sub_store.get(stream_id);
|
const sub = sub_store.get(stream_id);
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{operator: "channel", operand: sub.name},
|
{operator: "channel", operand: sub.name},
|
||||||
{operator: "topic", operand: topic},
|
{operator: "topic", operand: topic},
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ function register_click_handlers() {
|
|||||||
$("body").on("click", ".user-card-popover-actions .narrow_to_private_messages", (e) => {
|
$("body").on("click", ".user-card-popover-actions .narrow_to_private_messages", (e) => {
|
||||||
const user_id = elem_to_user_id($(e.target).parents("ul"));
|
const user_id = elem_to_user_id($(e.target).parents("ul"));
|
||||||
const email = people.get_by_user_id(user_id).email;
|
const email = people.get_by_user_id(user_id).email;
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "dm",
|
operator: "dm",
|
||||||
@@ -708,7 +708,7 @@ function register_click_handlers() {
|
|||||||
$("body").on("click", ".user-card-popover-actions .narrow_to_messages_sent", (e) => {
|
$("body").on("click", ".user-card-popover-actions .narrow_to_messages_sent", (e) => {
|
||||||
const user_id = elem_to_user_id($(e.target).parents("ul"));
|
const user_id = elem_to_user_id($(e.target).parents("ul"));
|
||||||
const email = people.get_by_user_id(user_id).email;
|
const email = people.get_by_user_id(user_id).email;
|
||||||
narrow.activate(
|
narrow.show(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
operator: "sender",
|
operator: "sender",
|
||||||
|
|||||||
@@ -181,9 +181,9 @@ function test_helper({override, override_rewire, change_tab}) {
|
|||||||
stub(ui_report, "error");
|
stub(ui_report, "error");
|
||||||
|
|
||||||
if (change_tab) {
|
if (change_tab) {
|
||||||
override_rewire(narrow, "activate", (terms) => {
|
override_rewire(narrow, "show", (terms) => {
|
||||||
narrow_terms = terms;
|
narrow_terms = terms;
|
||||||
events.push("narrow.activate");
|
events.push("narrow.show");
|
||||||
});
|
});
|
||||||
|
|
||||||
override(info_overlay, "show", (name) => {
|
override(info_overlay, "show", (name) => {
|
||||||
@@ -237,7 +237,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
|
|||||||
helper.assert_events([
|
helper.assert_events([
|
||||||
[overlays, "close_for_hash_change"],
|
[overlays, "close_for_hash_change"],
|
||||||
[message_viewport, "stop_auto_scrolling"],
|
[message_viewport, "stop_auto_scrolling"],
|
||||||
"narrow.activate",
|
"narrow.show",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
helper.clear_events();
|
helper.clear_events();
|
||||||
@@ -245,7 +245,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
|
|||||||
helper.assert_events([
|
helper.assert_events([
|
||||||
[overlays, "close_for_hash_change"],
|
[overlays, "close_for_hash_change"],
|
||||||
[message_viewport, "stop_auto_scrolling"],
|
[message_viewport, "stop_auto_scrolling"],
|
||||||
"narrow.activate",
|
"narrow.show",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Test old "#recent_topics" hash redirects to "#recent".
|
// Test old "#recent_topics" hash redirects to "#recent".
|
||||||
@@ -268,7 +268,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
|
|||||||
helper.assert_events([
|
helper.assert_events([
|
||||||
[overlays, "close_for_hash_change"],
|
[overlays, "close_for_hash_change"],
|
||||||
[message_viewport, "stop_auto_scrolling"],
|
[message_viewport, "stop_auto_scrolling"],
|
||||||
"narrow.activate",
|
"narrow.show",
|
||||||
]);
|
]);
|
||||||
let terms = helper.get_narrow_terms();
|
let terms = helper.get_narrow_terms();
|
||||||
assert.equal(terms[0].operand, "Denmark");
|
assert.equal(terms[0].operand, "Denmark");
|
||||||
@@ -280,7 +280,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
|
|||||||
helper.assert_events([
|
helper.assert_events([
|
||||||
[overlays, "close_for_hash_change"],
|
[overlays, "close_for_hash_change"],
|
||||||
[message_viewport, "stop_auto_scrolling"],
|
[message_viewport, "stop_auto_scrolling"],
|
||||||
"narrow.activate",
|
"narrow.show",
|
||||||
]);
|
]);
|
||||||
terms = helper.get_narrow_terms();
|
terms = helper.get_narrow_terms();
|
||||||
assert.equal(terms.length, 0);
|
assert.equal(terms.length, 0);
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ run_test("basic mappings", () => {
|
|||||||
|
|
||||||
assert_mapping("c", compose_actions, "start");
|
assert_mapping("c", compose_actions, "start");
|
||||||
assert_mapping("x", compose_actions, "start");
|
assert_mapping("x", compose_actions, "start");
|
||||||
assert_mapping("P", narrow, "activate");
|
assert_mapping("P", narrow, "show");
|
||||||
assert_mapping("g", gear_menu, "toggle");
|
assert_mapping("g", gear_menu, "toggle");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ run_test("show_invalid_narrow_message", ({mock_template}) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
run_test("narrow_to_compose_target errors", ({disallow_rewire}) => {
|
run_test("narrow_to_compose_target errors", ({disallow_rewire}) => {
|
||||||
disallow_rewire(narrow, "activate");
|
disallow_rewire(narrow, "show");
|
||||||
|
|
||||||
// No-op when not composing.
|
// No-op when not composing.
|
||||||
compose_state.set_message_type(undefined);
|
compose_state.set_message_type(undefined);
|
||||||
@@ -675,7 +675,7 @@ run_test("narrow_to_compose_target errors", ({disallow_rewire}) => {
|
|||||||
|
|
||||||
run_test("narrow_to_compose_target streams", ({override_rewire}) => {
|
run_test("narrow_to_compose_target streams", ({override_rewire}) => {
|
||||||
const args = {called: false};
|
const args = {called: false};
|
||||||
override_rewire(narrow, "activate", (terms, opts) => {
|
override_rewire(narrow, "show", (terms, opts) => {
|
||||||
args.terms = terms;
|
args.terms = terms;
|
||||||
args.opts = opts;
|
args.opts = opts;
|
||||||
args.called = true;
|
args.called = true;
|
||||||
@@ -723,7 +723,7 @@ run_test("narrow_to_compose_target streams", ({override_rewire}) => {
|
|||||||
|
|
||||||
run_test("narrow_to_compose_target direct messages", ({override, override_rewire}) => {
|
run_test("narrow_to_compose_target direct messages", ({override, override_rewire}) => {
|
||||||
const args = {called: false};
|
const args = {called: false};
|
||||||
override_rewire(narrow, "activate", (terms, opts) => {
|
override_rewire(narrow, "show", (terms, opts) => {
|
||||||
args.terms = terms;
|
args.terms = terms;
|
||||||
args.opts = opts;
|
args.opts = opts;
|
||||||
args.called = true;
|
args.called = true;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ mock_esm("../src/unread_ui", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// We have strange hacks in narrow.activate to sleep 0
|
// We have strange hacks in narrow.show to sleep 0
|
||||||
// seconds.
|
// seconds.
|
||||||
set_global("setTimeout", (f, t) => {
|
set_global("setTimeout", (f, t) => {
|
||||||
assert.equal(t, 0);
|
assert.equal(t, 0);
|
||||||
@@ -211,7 +211,7 @@ run_test("basics", ({override}) => {
|
|||||||
opts.cont();
|
opts.cont();
|
||||||
};
|
};
|
||||||
|
|
||||||
narrow.activate(terms, {
|
narrow.show(terms, {
|
||||||
then_select_id: selected_id,
|
then_select_id: selected_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ run_test("basics", ({override}) => {
|
|||||||
message_lists.current.selected_id = () => -1;
|
message_lists.current.selected_id = () => -1;
|
||||||
message_lists.current.get_row = () => row;
|
message_lists.current.get_row = () => row;
|
||||||
|
|
||||||
narrow.activate([{operator: "is", operand: "private"}], {
|
narrow.show([{operator: "is", operand: "private"}], {
|
||||||
then_select_id: selected_id,
|
then_select_id: selected_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ run_test("basics", ({override}) => {
|
|||||||
row.get_offset_to_window = () => ({top: 100, bottom: 150});
|
row.get_offset_to_window = () => ({top: 100, bottom: 150});
|
||||||
message_lists.current.get_row = () => row;
|
message_lists.current.get_row = () => row;
|
||||||
|
|
||||||
narrow.activate(terms, {
|
narrow.show(terms, {
|
||||||
then_select_id: selected_id,
|
then_select_id: selected_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ run_test("basics", ({override}) => {
|
|||||||
row.get_offset_to_window = () => ({top: 150, bottom: 250});
|
row.get_offset_to_window = () => ({top: 150, bottom: 250});
|
||||||
message_lists.current.get_row = () => row;
|
message_lists.current.get_row = () => row;
|
||||||
|
|
||||||
narrow.activate(terms, {
|
narrow.show(terms, {
|
||||||
then_select_id: selected_id,
|
then_select_id: selected_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user