Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

web-narrow: Update operators to use channel and channels.

Lauryn Menard58b91202f4a1
diff --git a/web/src/drafts_overlay_ui.js b/web/src/drafts_overlay_ui.js
index 74ab49c11ae..5dd2973e139 100644
--- a/web/src/drafts_overlay_ui.js
+++ b/web/src/drafts_overlay_ui.js
@@ -27,7 +27,7 @@ function restore_draft(draft_id) {
narrow.activate(
[
{
- operator: "stream",
+ operator: "channel",
operand: stream_data.get_stream_name_from_id(compose_args.stream_id),
},
{operator: "topic", operand: compose_args.topic},
diff --git a/web/src/hash_util.ts b/web/src/hash_util.ts
index c496d85426b..a5897cf731d 100644
--- a/web/src/hash_util.ts
+++ b/web/src/hash_util.ts
@@ -156,7 +156,7 @@ export function group_edit_url(group: UserGroup, right_side_tab: string): string
}
export function search_public_streams_notice_url(terms: NarrowTerm[]): string {
- const public_operator = {operator: "streams", operand: "public"};
+ const public_operator = {operator: "channels", operand: "public"};
return search_terms_to_hash([public_operator, ...terms]);
}
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index ee9f8ddbc85..642d8463043 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -1209,7 +1209,7 @@ export function process_hotkey(e, hotkey) {
narrow.activate(
[
{
- operator: "stream",
+ operator: "channel",
operand: stream_data.get_stream_name_from_id(msg.stream_id),
},
{operator: "topic", operand: msg.topic},
diff --git a/web/src/message_edit.js b/web/src/message_edit.js
index b88e2fc3d3c..27b6d717420 100644
--- a/web/src/message_edit.js
+++ b/web/src/message_edit.js
@@ -1393,7 +1393,7 @@ export function with_first_message_id(stream_id, topic_name, success_cb, error_c
num_before: 1,
num_after: 0,
narrow: JSON.stringify([
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
{operator: "topic", operand: topic_name},
]),
};
@@ -1421,7 +1421,7 @@ export function is_message_oldest_or_newest(
num_before: 1,
num_after: 1,
narrow: JSON.stringify([
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
{operator: "topic", operand: topic_name},
]),
};
diff --git a/web/src/message_events.js b/web/src/message_events.js
index f0410dad0ef..230da029059 100644
--- a/web/src/message_events.js
+++ b/web/src/message_events.js
@@ -406,7 +406,7 @@ export function update_messages(events) {
// The fix is likely somewhat involved, so punting for now.
const new_stream_name = sub_store.get(new_stream_id).name;
new_filter = new_filter.filter_with_new_params({
- operator: "stream",
+ operator: "channel",
operand: new_stream_name,
});
changed_narrow = true;
diff --git a/web/src/message_flags.ts b/web/src/message_flags.ts
index e657eb54bae..0014a60c54e 100644
--- a/web/src/message_flags.ts
+++ b/web/src/message_flags.ts
@@ -102,7 +102,7 @@ export function unstar_all_messages_in_topic(stream_id: number, topic: string):
num_before: 1000,
num_after: 0,
narrow: JSON.stringify([
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
{operator: "topic", operand: topic},
{operator: "is", operand: "starred"},
]),
diff --git a/web/src/narrow.js b/web/src/narrow.js
index c79bb3e0388..010976ea13f 100644
--- a/web/src/narrow.js
+++ b/web/src/narrow.js
@@ -843,7 +843,7 @@ export function render_message_list_with_selected_message(opts) {
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}];
+ const filter_expr = [{operator: "channel", operand: stream_name}];
activate(filter_expr, {});
}
@@ -914,7 +914,7 @@ export function narrow_to_next_topic(opts = {}) {
}
const filter_expr = [
- {operator: "stream", operand: next_narrow.stream},
+ {operator: "channel", operand: next_narrow.stream},
{operator: "topic", operand: next_narrow.topic},
];
@@ -980,7 +980,7 @@ export function by_topic(target_id, opts) {
const stream_name = stream_data.get_stream_name_from_id(original.stream_id);
const search_terms = [
- {operator: "stream", operand: stream_name},
+ {operator: "channel", operand: stream_name},
{operator: "topic", operand: original.topic},
];
opts = {then_select_id: target_id, ...opts};
@@ -1042,7 +1042,7 @@ export function to_compose_target() {
const stream_name = stream_data.get_sub_by_id(stream_id).name;
// If we are composing to a new topic, we narrow to the stream but
// grey-out the message view instead of narrowing to an empty view.
- const terms = [{operator: "stream", operand: stream_name}];
+ const terms = [{operator: "channel", operand: stream_name}];
const topic = compose_state.topic();
if (topic !== "") {
terms.push({operator: "topic", operand: topic});
diff --git a/web/src/scheduled_messages_ui.js b/web/src/scheduled_messages_ui.js
index 319e4b98b02..f1763b658c8 100644
--- a/web/src/scheduled_messages_ui.js
+++ b/web/src/scheduled_messages_ui.js
@@ -22,7 +22,7 @@ function narrow_via_edit_scheduled_message(compose_args) {
narrow.activate(
[
{
- operator: "stream",
+ operator: "channel",
operand: stream_data.get_stream_name_from_id(compose_args.stream_id),
},
{operator: "topic", operand: compose_args.topic},
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 2068a1ee7ea..719424aad17 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -863,7 +863,7 @@ export function initialize_everything(state_data) {
const sub = sub_store.get(stream_id);
narrow.activate(
[
- {operator: "stream", operand: sub.name},
+ {operator: "channel", operand: sub.name},
{operator: "topic", operand: topic},
],
{trigger: "sidebar"},
diff --git a/web/src/unread_ops.js b/web/src/unread_ops.js
index 5b16df008e9..bfbdeda2e8d 100644
--- a/web/src/unread_ops.js
+++ b/web/src/unread_ops.js
@@ -479,7 +479,7 @@ export function mark_stream_as_read(stream_id) {
bulk_update_read_flags_for_narrow(
[
{operator: "is", operand: "unread", negated: false},
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
],
"add",
{
@@ -492,7 +492,7 @@ export function mark_topic_as_read(stream_id, topic) {
bulk_update_read_flags_for_narrow(
[
{operator: "is", operand: "unread", negated: false},
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
{operator: "topic", operand: topic},
],
"add",
@@ -506,7 +506,7 @@ export function mark_topic_as_read(stream_id, topic) {
export function mark_topic_as_unread(stream_id, topic) {
bulk_update_read_flags_for_narrow(
[
- {operator: "stream", operand: stream_id},
+ {operator: "channel", operand: stream_id},
{operator: "topic", operand: topic},
],
"remove",
diff --git a/web/tests/message_flags.test.js b/web/tests/message_flags.test.js
index b5120691746..92572811284 100644
--- a/web/tests/message_flags.test.js
+++ b/web/tests/message_flags.test.js
@@ -136,7 +136,7 @@ run_test("unstar_all_in_topic", ({override}) => {
num_before: 1000,
num_after: 0,
narrow: JSON.stringify([
- {operator: "stream", operand: 20},
+ {operator: "channel", operand: 20},
{operator: "topic", operand: "topic"},
{operator: "is", operand: "starred"},
]),
diff --git a/web/tests/narrow.test.js b/web/tests/narrow.test.js
index 49ead0af22b..439d49648d6 100644
--- a/web/tests/narrow.test.js
+++ b/web/tests/narrow.test.js
@@ -692,7 +692,7 @@ run_test("narrow_to_compose_target streams", ({override_rewire}) => {
assert.equal(args.called, true);
assert.equal(args.opts.trigger, "narrow_to_compose_target");
assert.deepEqual(args.terms, [
- {operator: "stream", operand: "ROME"},
+ {operator: "channel", operand: "ROME"},
{operator: "topic", operand: "one"},
]);
@@ -702,7 +702,7 @@ run_test("narrow_to_compose_target streams", ({override_rewire}) => {
narrow.to_compose_target();
assert.equal(args.called, true);
assert.deepEqual(args.terms, [
- {operator: "stream", operand: "ROME"},
+ {operator: "channel", operand: "ROME"},
{operator: "topic", operand: "four"},
]);
@@ -711,14 +711,14 @@ run_test("narrow_to_compose_target streams", ({override_rewire}) => {
args.called = false;
narrow.to_compose_target();
assert.equal(args.called, true);
- assert.deepEqual(args.terms, [{operator: "stream", operand: "ROME"}]);
+ assert.deepEqual(args.terms, [{operator: "channel", operand: "ROME"}]);
// Test with no topic
compose_state.topic(undefined);
args.called = false;
narrow.to_compose_target();
assert.equal(args.called, true);
- assert.deepEqual(args.terms, [{operator: "stream", operand: "ROME"}]);
+ assert.deepEqual(args.terms, [{operator: "channel", operand: "ROME"}]);
});
run_test("narrow_to_compose_target direct messages", ({override, override_rewire}) => {