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.

narrow-state: Use stream_id function to get StreamSubscription.

Lauryn Menard4ab4b7d435f1
diff --git a/web/src/narrow_state.ts b/web/src/narrow_state.ts
index f5ee6a12213..9d948e59873 100644
--- a/web/src/narrow_state.ts
+++ b/web/src/narrow_state.ts
@@ -147,22 +147,17 @@ export function stream_name(current_filter: Filter | undefined = filter()): stri
if (id === undefined) {
return undefined;
}
- const sub = stream_data.get_sub_by_id(id);
- return sub?.name;
+ return stream_data.get_sub_by_id(id)?.name;
}
export function stream_sub(
current_filter: Filter | undefined = filter(),
): StreamSubscription | undefined {
- if (current_filter === undefined) {
- return undefined;
- }
- const stream_operands = current_filter.operands("channel");
-
- if (stream_operands.length !== 1 || stream_operands[0] === undefined) {
+ const id = stream_id(current_filter);
+ if (id === undefined) {
return undefined;
}
- return stream_data.get_sub_by_id_string(stream_operands[0]);
+ return stream_data.get_sub_by_id(id);
}
export let topic = (current_filter: Filter | undefined = filter()): string | undefined => {