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_list: Fix incorrect check for emptyness.

Aman Agrawald3ed1b749178
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index f984c8221e6..c1e3caa4620 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -572,7 +572,7 @@ export function get_stream_li(stream_id: number): JQuery | undefined {
}
const $li = row.get_li();
- if (!$li) {
+ if ($li.length === 0) {
blueslip.error("Cannot find li", {stream_id});
return undefined;
}
diff --git a/web/tests/stream_list.test.cjs b/web/tests/stream_list.test.cjs
index 4b6e87de664..5ec5cb07e31 100644
--- a/web/tests/stream_list.test.cjs
+++ b/web/tests/stream_list.test.cjs
@@ -207,7 +207,7 @@ test_ui("create_sidebar_row", ({override, override_rewire, mock_template}) => {
const $social_li = $("<social-sidebar-row-stub>");
const stream_id = social.stream_id;
- $social_li.length = 0;
+ $social_li.length = 1;
const $privacy_elem = $.create("privacy-stub");
$social_li.set_find_results(".stream-privacy", $privacy_elem);
@@ -627,7 +627,7 @@ test_ui("rename_stream", ({mock_template, override, override_rewire}) => {
stream_data.rename_sub(sub, new_name);
const $li_stub = $.create("li stub");
- $li_stub.length = 0;
+ $li_stub.length = 1;
mock_template("stream_sidebar_row.hbs", false, (payload) => {
assert.deepEqual(payload, {