narrow: Rename by_recipient to narrow_by_recipient.

This would make the call `message_view.narrow_by_recipient` sound
better than `message_view.by_recipient`.
This commit is contained in:
Aman Agrawal 2024-06-05 07:35:04 +00:00 committed by Tim Abbott
parent 9374195418
commit 69cd263312
5 changed files with 6 additions and 6 deletions

View File

@ -474,7 +474,7 @@ export function initialize() {
} }
e.preventDefault(); e.preventDefault();
const row_id = get_row_id_for_narrowing(this); const row_id = get_row_id_for_narrowing(this);
narrow.by_recipient(row_id, {trigger: "message header"}); narrow.narrow_by_recipient(row_id, {trigger: "message header"});
}); });
$("#message_feed_container").on("click", ".narrows_by_topic", function (e) { $("#message_feed_container").on("click", ".narrows_by_topic", function (e) {

View File

@ -49,7 +49,7 @@ export function initialize() {
if (message.type === "stream") { if (message.type === "stream") {
narrow.by_topic(message_id, {trigger: "desktop_notification_reply"}); narrow.by_topic(message_id, {trigger: "desktop_notification_reply"});
} else { } else {
narrow.by_recipient(message_id, {trigger: "desktop_notification_reply"}); narrow.narrow_by_recipient(message_id, {trigger: "desktop_notification_reply"});
} }
} }

View File

@ -1091,7 +1091,7 @@ export function process_hotkey(e, hotkey) {
case "toggle_conversation_view": case "toggle_conversation_view":
if (narrow_state.narrowed_by_topic_reply()) { if (narrow_state.narrowed_by_topic_reply()) {
// narrow to stream if user is in topic view // narrow to stream if user is in topic view
return do_narrow_action(narrow.by_recipient); return do_narrow_action(narrow.narrow_by_recipient);
} else if (narrow_state.narrowed_by_pm_reply()) { } else if (narrow_state.narrowed_by_pm_reply()) {
// do nothing if user is in DM view // do nothing if user is in DM view
return false; return false;

View File

@ -1003,7 +1003,7 @@ export function by_topic(target_id, opts) {
if (original.type !== "stream") { if (original.type !== "stream") {
// Only stream messages have topics, but the // Only stream messages have topics, but the
// user wants us to narrow in some way. // user wants us to narrow in some way.
by_recipient(target_id, opts); narrow_by_recipient(target_id, opts);
return; return;
} }
@ -1027,7 +1027,7 @@ export function by_topic(target_id, opts) {
activate(search_terms, opts); activate(search_terms, opts);
} }
export function by_recipient(target_id, opts) { export function narrow_by_recipient(target_id, opts) {
opts = {then_select_id: target_id, ...opts}; opts = {then_select_id: target_id, ...opts};
// don't use message_lists.current as it won't work for muted messages or for out-of-narrow links // don't use message_lists.current as it won't work for muted messages or for out-of-narrow links
const message = message_store.get(target_id); const message = message_store.get(target_id);

View File

@ -381,7 +381,7 @@ run_test("misc", ({override}) => {
assert_mapping("e", message_edit, "start"); assert_mapping("e", message_edit, "start");
override(narrow_state, "narrowed_by_topic_reply", () => true); override(narrow_state, "narrowed_by_topic_reply", () => true);
assert_mapping("s", narrow, "by_recipient"); assert_mapping("s", narrow, "narrow_by_recipient");
override(narrow_state, "narrowed_by_topic_reply", () => false); override(narrow_state, "narrowed_by_topic_reply", () => false);
override(narrow_state, "narrowed_by_pm_reply", () => true); override(narrow_state, "narrowed_by_pm_reply", () => true);