narrow_state: Remove unused narrowed_to_search, narrowed_to_starred.

They’re unused as of commit de0db7ad1a
(#28636).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-03-28 16:03:44 -07:00 committed by Tim Abbott
parent b11bf32f8f
commit 8f07d830f2
2 changed files with 0 additions and 23 deletions

View File

@ -369,17 +369,6 @@ export function narrowed_to_topic(current_filter: Filter | undefined = filter())
return current_filter.has_operator("stream") && current_filter.has_operator("topic");
}
export function narrowed_to_search(current_filter: Filter | undefined = filter()): boolean {
return current_filter !== undefined && current_filter.is_keyword_search();
}
export function narrowed_to_starred(current_filter: Filter | undefined = filter()): boolean {
if (current_filter === undefined) {
return false;
}
return current_filter.has_operand("is", "starred");
}
export function is_for_stream_id(stream_id: number, filter?: Filter): boolean {
// This is not perfect, since we still track narrows by
// name, not id, but at least the interface is good going

View File

@ -74,31 +74,25 @@ test("narrowed", () => {
assert.ok(!narrow_state.narrowed_by_reply());
assert.ok(!narrow_state.narrowed_by_pm_reply());
assert.ok(!narrow_state.narrowed_by_topic_reply());
assert.ok(!narrow_state.narrowed_to_search());
assert.ok(!narrow_state.narrowed_to_topic());
assert.ok(!narrow_state.narrowed_by_stream_reply());
assert.equal(narrow_state.stream_sub(), undefined);
assert.ok(!narrow_state.narrowed_to_starred());
set_filter([["stream", "Foo"]]);
assert.ok(!narrow_state.narrowed_to_pms());
assert.ok(!narrow_state.narrowed_by_reply());
assert.ok(!narrow_state.narrowed_by_pm_reply());
assert.ok(!narrow_state.narrowed_by_topic_reply());
assert.ok(!narrow_state.narrowed_to_search());
assert.ok(!narrow_state.narrowed_to_topic());
assert.ok(narrow_state.narrowed_by_stream_reply());
assert.ok(!narrow_state.narrowed_to_starred());
set_filter([["dm", "steve@zulip.com"]]);
assert.ok(narrow_state.narrowed_to_pms());
assert.ok(narrow_state.narrowed_by_reply());
assert.ok(narrow_state.narrowed_by_pm_reply());
assert.ok(!narrow_state.narrowed_by_topic_reply());
assert.ok(!narrow_state.narrowed_to_search());
assert.ok(!narrow_state.narrowed_to_topic());
assert.ok(!narrow_state.narrowed_by_stream_reply());
assert.ok(!narrow_state.narrowed_to_starred());
set_filter([
["stream", "Foo"],
@ -108,30 +102,24 @@ test("narrowed", () => {
assert.ok(narrow_state.narrowed_by_reply());
assert.ok(!narrow_state.narrowed_by_pm_reply());
assert.ok(narrow_state.narrowed_by_topic_reply());
assert.ok(!narrow_state.narrowed_to_search());
assert.ok(narrow_state.narrowed_to_topic());
assert.ok(!narrow_state.narrowed_by_stream_reply());
assert.ok(!narrow_state.narrowed_to_starred());
set_filter([["search", "grail"]]);
assert.ok(!narrow_state.narrowed_to_pms());
assert.ok(!narrow_state.narrowed_by_reply());
assert.ok(!narrow_state.narrowed_by_pm_reply());
assert.ok(!narrow_state.narrowed_by_topic_reply());
assert.ok(narrow_state.narrowed_to_search());
assert.ok(!narrow_state.narrowed_to_topic());
assert.ok(!narrow_state.narrowed_by_stream_reply());
assert.ok(!narrow_state.narrowed_to_starred());
set_filter([["is", "starred"]]);
assert.ok(!narrow_state.narrowed_to_pms());
assert.ok(!narrow_state.narrowed_by_reply());
assert.ok(!narrow_state.narrowed_by_pm_reply());
assert.ok(!narrow_state.narrowed_by_topic_reply());
assert.ok(!narrow_state.narrowed_to_search());
assert.ok(!narrow_state.narrowed_to_topic());
assert.ok(!narrow_state.narrowed_by_stream_reply());
assert.ok(narrow_state.narrowed_to_starred());
});
test("terms", () => {