narrow: Rename by_topic to narrow_by_topic.

This commit is contained in:
Aman Agrawal
2024-06-05 07:41:40 +00:00
committed by Tim Abbott
parent fecb9afa94
commit 48cdfd25f7
8 changed files with 9 additions and 9 deletions

View File

@@ -483,7 +483,7 @@ export function initialize() {
}
e.preventDefault();
const row_id = get_row_id_for_narrowing(this);
narrow.by_topic(row_id, {trigger: "message header"});
narrow.narrow_by_topic(row_id, {trigger: "message header"});
});
// SIDEBARS

View File

@@ -27,7 +27,7 @@ export function initialize() {
// The code below is for sending a message received from notification reply which
// is often referred to as inline reply feature. This is done so desktop app doesn't
// have to depend on channel.post for setting crsf_token and narrow.by_topic
// have to depend on channel.post for setting crsf_token and narrow.narrow_by_topic
// to narrow to the message being sent.
if (window.electron_bridge.set_send_notification_reply_message_supported !== undefined) {
window.electron_bridge.set_send_notification_reply_message_supported(true);
@@ -47,7 +47,7 @@ export function initialize() {
function success() {
if (message.type === "stream") {
narrow.by_topic(message_id, {trigger: "desktop_notification_reply"});
narrow.narrow_by_topic(message_id, {trigger: "desktop_notification_reply"});
} else {
narrow.narrow_by_recipient(message_id, {trigger: "desktop_notification_reply"});
}

View File

@@ -1097,7 +1097,7 @@ export function process_hotkey(e, hotkey) {
return false;
}
// else narrow to conversation view (topic / DM)
return do_narrow_action(narrow.by_topic);
return do_narrow_action(narrow.narrow_by_topic);
case "toggle_stream_subscription":
deprecated_feature_notice.maybe_show_deprecation_notice("Shift + S");
return true;

View File

@@ -152,7 +152,7 @@ export function insert_new_messages(messages, sent_by_this_client) {
if (sent_by_this_client) {
compose_notifications.notify_local_mixes(messages, need_user_to_scroll, {
narrow_to_recipient(message_id) {
narrow.by_topic(message_id, {trigger: "outside_current_view"});
narrow.narrow_by_topic(message_id, {trigger: "outside_current_view"});
},
});
}

View File

@@ -162,7 +162,7 @@ export function process_notification(notification) {
notification_object.addEventListener("click", () => {
notification_object.close();
if (message.type !== "test-notification") {
narrow.by_topic(message.id, {trigger: "notification"});
narrow.narrow_by_topic(message.id, {trigger: "notification"});
}
window.focus();
});

View File

@@ -997,7 +997,7 @@ export function narrow_to_next_pm_string(opts = {}) {
show(filter_expr, updated_opts);
}
export function by_topic(target_id, opts) {
export function narrow_by_topic(target_id, opts) {
// don't use message_lists.current 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") {

View File

@@ -839,7 +839,7 @@ export function initialize_everything(state_data) {
compose_notifications.initialize({
on_click_scroll_to_selected: message_viewport.scroll_to_selected,
on_narrow_to_recipient(message_id) {
narrow.by_topic(message_id, {trigger: "compose_notification"});
narrow.narrow_by_topic(message_id, {trigger: "compose_notification"});
},
});
unread_ops.initialize();

View File

@@ -389,7 +389,7 @@ run_test("misc", ({override}) => {
override(narrow_state, "narrowed_by_topic_reply", () => false);
override(narrow_state, "narrowed_by_pm_reply", () => false);
assert_mapping("s", narrow, "by_topic");
assert_mapping("s", message_view, "narrow_by_topic");
override(message_edit, "can_move_message", () => true);
assert_mapping("m", stream_popover, "build_move_topic_to_stream_popover");