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.

stream_events: Remove error for undefined sub, enforce through typescript.

evykassirer12c18a026b8d
diff --git a/web/src/stream_events.ts b/web/src/stream_events.ts
index c01751f60ef..d9983ccb5f6 100644
--- a/web/src/stream_events.ts
+++ b/web/src/stream_events.ts
@@ -182,15 +182,10 @@ function show_first_stream_created_modal(stream: StreamSubscription): void {
// It's likely we should be passing in the full sub object from the caller/backend,
// but for now we just pass in the subscribers and color (things likely to be different).
export function mark_subscribed(
- sub: StreamSubscription | undefined,
+ sub: StreamSubscription,
subscribers: number[],
color: string | undefined,
): void {
- if (sub === undefined) {
- blueslip.error("Undefined sub passed to mark_subscribed");
- return;
- }
-
if (sub.subscribed) {
return;
}
diff --git a/web/tests/stream_events.test.cjs b/web/tests/stream_events.test.cjs
index 9ea443a8257..2eba30cc974 100644
--- a/web/tests/stream_events.test.cjs
+++ b/web/tests/stream_events.test.cjs
@@ -289,13 +289,6 @@ test("marked_(un)subscribed (early return)", () => {
stream_events.mark_unsubscribed({subscribed: false});
});
-test("marked_subscribed (error)", () => {
- // Test undefined error
- blueslip.expect("error", "Undefined sub passed to mark_subscribed");
- stream_events.mark_subscribed(undefined, [], "yellow");
- blueslip.reset();
-});
-
test("marked_subscribed (normal)", ({override}) => {
const sub = {...frontend};
stream_data.add_sub(sub);