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-settings: Allow filtering streams by folder.

Sahil Batra6244621008ad
diff --git a/docs/THIRDPARTY b/docs/THIRDPARTY
index bbb94dbca81..2fcac54dd42 100644
--- a/docs/THIRDPARTY
+++ b/docs/THIRDPARTY
@@ -266,10 +266,19 @@ Files: web/icons/folder.svg
Copyright: 2013-2023 Cole Bemis (https://lucide.dev/icons/folder)
License: ISC License
+Files: web/icons/folder-chevron.svg
+Copyright: 2013-2023 Cole Bemis (https://lucide.dev/icons/folder-cog)
+License: ISC License
+Comment: Icon has been modified by Karl Stolley
+
Files: web/icons/folder-cog.svg
Copyright: 2013-2023 Cole Bemis (https://lucide.dev/icons/folder-cog)
License: ISC License
+Files: web/icons/folder-search.svg
+Copyright: 2013-2023 Cole Bemis (https://lucide.dev/icons/folder-search)
+License: ISC License
+
Files: web/icons/follow.svg
Copyright: 2013-2023 Cole Bemis (https://lucide.dev/icons/rss)
License: ISC License
diff --git a/web/icons/folder-chevron.svg b/web/icons/folder-chevron.svg
new file mode 100644
index 00000000000..f6e719c55d8
--- /dev/null
+++ b/web/icons/folder-chevron.svg
@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M 4,2 C 2.3549904,2 1,3.3549904 1,5 v 13 c 0,1.64501 1.3549904,3 3,3 h 6.300781 a 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 H 4 C 3.4358706,19 3,18.564129 3,18 V 5 C 3,4.4358706 3.4358706,4 4,4 h 3.9804687 a 1.0001,1.0001 0 0 0 0.00977,0 c 0.3385977,-0.00332 0.6498014,0.1642012 0.8378906,0.4453125 l 0.625,1.1367187 a 1.0001,1.0001 0 0 0 0.041016,0.068359 C 10.048363,6.4919664 10.992324,6.9998341 12,7 h 8 c 0.564129,0 1,0.4358706 1,1 v 3.300781 a 1,1 0 0 0 1,1 1,1 0 0 0 1,-1 V 8 C 23,6.3549904 21.64501,5 20,5 H 12 C 11.665002,4.9999448 11.357974,4.8327914 11.171875,4.5546875 l -0.625,-1.1367187 a 1.0001,1.0001 0 0 0 -0.04102,-0.068359 C 9.9458514,2.4991412 8.9889395,1.990017 7.9707031,2 Z" />
+ <path
+ d="m 13.105469,14.875 a 1,1 0 0 0 -0.707031,0.292969 1,1 0 0 0 0,1.414062 l 4.585937,4.585938 a 1.0001,1.0001 0 0 0 1.410156,0.0039 l 4.644531,-4.597656 a 1,1 0 0 0 0.0078,-1.414063 1,1 0 0 0 -1.414063,-0.0059 l -3.9375,3.896484 L 13.8125,15.167969 A 1,1 0 0 0 13.105469,14.875 Z" />
+</svg>
diff --git a/web/icons/folder-search.svg b/web/icons/folder-search.svg
new file mode 100644
index 00000000000..4e91124b777
--- /dev/null
+++ b/web/icons/folder-search.svg
@@ -0,0 +1,12 @@
+<svg
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M 4,2 C 2.354992,2 1,3.354992 1,5 v 13 c 0,1.645008 1.354992,3 3,3 h 6.699219 a 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 H 4 C 3.4358712,19 3,18.564129 3,18 V 5 C 3,4.4358712 3.4358712,4 4,4 h 3.9003906 a 1.0001,1.0001 0 0 0 0.00977,0 c 0.3410981,-0.00334 0.6561535,0.1643212 0.8437501,0.4492187 a 1.0001,1.0001 0 0 0 0.00781,0.00977 L 9.5644531,5.6503906 C 10.118675,6.4919656 11.062637,6.9998341 12.070313,7 H 20 c 0.564129,0 1,0.4358712 1,1 v 4.099609 a 1,1 0 0 0 1,1 1,1 0 0 0 1,-1 V 8 C 23,6.354992 21.645008,5 20,5 H 12.070313 C 11.732817,4.9999444 11.419998,4.8326458 11.234375,4.5507812 a 1.0001,1.0001 0 0 0 -0.0059,-0.00977 L 10.425781,3.3496094 c -7.94e-4,-0.00121 -0.0031,-7.486e-4 -0.0039,-0.00195 C 9.8615388,2.4993607 8.9074166,1.9900312 7.890625,2 Z" />
+ <path
+ d="m 18.392578,18.392578 a 1,1 0 0 0 0,1.414063 l 1.900391,1.90039 a 1,1 0 0 0 1.414062,0 1,1 0 0 0 0,-1.414062 l -1.90039,-1.900391 a 1,1 0 0 0 -1.414063,0 z" />
+ <path
+ d="m 17,13 c -2.197292,0 -4,1.802708 -4,4 0,2.197292 1.802708,4 4,4 2.197292,0 4,-1.802708 4,-4 0,-2.197292 -1.802708,-4 -4,-4 z m 0,2 c 1.116413,0 2,0.883587 2,2 0,1.116413 -0.883587,2 -2,2 -1.116413,0 -2,-0.883587 -2,-2 0,-1.116413 0.883587,-2 2,-2 z" />
+</svg>
diff --git a/web/src/channel_folders.ts b/web/src/channel_folders.ts
index 9b85d6a7b84..8318fe156a0 100644
--- a/web/src/channel_folders.ts
+++ b/web/src/channel_folders.ts
@@ -180,3 +180,16 @@ export function reorder(order: number[]): void {
channel_folder.order = index;
}
}
+
+export function get_folders_with_accessible_channels(): ChannelFolder[] {
+ const all_subs = stream_data.get_unsorted_subs();
+
+ const channel_folder_ids = new Set<number>();
+ for (const sub of all_subs) {
+ if (sub.folder_id !== null) {
+ channel_folder_ids.add(sub.folder_id);
+ }
+ }
+
+ return get_channel_folders().filter((folder) => channel_folder_ids.has(folder.id));
+}
diff --git a/web/src/stream_settings_components.ts b/web/src/stream_settings_components.ts
index 826afdc9ce7..09f685b0043 100644
--- a/web/src/stream_settings_components.ts
+++ b/web/src/stream_settings_components.ts
@@ -32,6 +32,7 @@ import * as user_groups from "./user_groups.ts";
export let archived_status_filter_dropdown_widget: DropdownWidget;
export let channel_creation_privacy_widget: DropdownWidget;
+let folder_filter_dropdown_widget: DropdownWidget;
export function set_right_panel_title(sub: StreamSubscription): void {
let title_icon_color = "#333333";
@@ -303,6 +304,22 @@ export function set_archived_status_filters_for_tests(filter_widget: DropdownWid
archived_status_filter_dropdown_widget = filter_widget;
}
+export function set_folder_filter_dropdown_widget(widget: DropdownWidget): void {
+ folder_filter_dropdown_widget = widget;
+}
+
+export function get_folder_filter_dropdown_value(): number {
+ return z.number().parse(folder_filter_dropdown_widget.value());
+}
+
+export function set_folder_filter_dropdown_value(value: number): void {
+ folder_filter_dropdown_widget.render(value);
+}
+
+export function set_folder_filter_for_tests(filter_widget: DropdownWidget): void {
+ folder_filter_dropdown_widget = filter_widget;
+}
+
export function archived_status_filter_includes_channel(sub: StreamSubscription): boolean {
const filter_value = get_archived_status_filter_dropdown_value();
const FILTERS = stream_settings_data.ARCHIVED_STATUS_FILTERS;
@@ -315,6 +332,19 @@ export function archived_status_filter_includes_channel(sub: StreamSubscription)
return true;
}
+export function folder_filter_includes_channel(sub: StreamSubscription): boolean {
+ const filters = stream_settings_data.FOLDER_FILTERS;
+ const filter_value = get_folder_filter_dropdown_value();
+ if (filter_value === filters.ANY_FOLDER_DROPDOWN_OPTION) {
+ return true;
+ }
+
+ if (filter_value === filters.UNCATEGORIZED_DROPDOWN_OPTION) {
+ return sub.folder_id === null;
+ }
+ return filter_value === sub.folder_id;
+}
+
export function set_up_folder_dropdown_widget(sub?: StreamSubscription): DropdownWidget {
const folder_options = (): dropdown_widget.Option[] => {
const folders = channel_folders.get_channel_folders();
diff --git a/web/src/stream_settings_data.ts b/web/src/stream_settings_data.ts
index eead3922970..f0d3cfaee49 100644
--- a/web/src/stream_settings_data.ts
+++ b/web/src/stream_settings_data.ts
@@ -35,6 +35,11 @@ export const ARCHIVED_STATUS_FILTERS = {
ARCHIVED_CHANNELS: "archived_channels",
};
+export const FOLDER_FILTERS = {
+ UNCATEGORIZED_DROPDOWN_OPTION: -1,
+ ANY_FOLDER_DROPDOWN_OPTION: -2,
+};
+
export function get_sub_for_settings(sub: StreamSubscription): SettingsSubscription {
return {
...sub,
diff --git a/web/src/stream_settings_ui.ts b/web/src/stream_settings_ui.ts
index f48877458d9..bf733cde0b8 100644
--- a/web/src/stream_settings_ui.ts
+++ b/web/src/stream_settings_ui.ts
@@ -1,7 +1,7 @@
import $ from "jquery";
import _ from "lodash";
import assert from "minimalistic-assert";
-import type * as tippy from "tippy.js";
+import * as tippy from "tippy.js";
import render_stream_creation_confirmation_banner from "../templates/modal_banner/stream_creation_confirmation_banner.hbs";
import render_browse_streams_list from "../templates/stream_settings/browse_streams_list.hbs";
@@ -11,6 +11,7 @@ import render_stream_settings_overlay from "../templates/stream_settings/stream_
import type {Banner} from "./banners.ts";
import * as blueslip from "./blueslip.ts";
import * as browser_history from "./browser_history.ts";
+import * as channel_folders from "./channel_folders.ts";
import * as components from "./components.ts";
import type {Toggle} from "./components.ts";
import * as compose_banner from "./compose_banner.ts";
@@ -50,6 +51,7 @@ import type {StreamPermissionGroupSetting, StreamTopicsPolicy} from "./stream_ty
import * as stream_ui_updates from "./stream_ui_updates.ts";
import * as sub_store from "./sub_store.ts";
import type {StreamSubscription} from "./sub_store.ts";
+import {LONG_HOVER_DELAY} from "./tippyjs.ts";
import * as util from "./util.ts";
import * as views_util from "./views_util.ts";
@@ -353,7 +355,10 @@ export function add_sub_to_table(sub: StreamSubscription): void {
const html = render_browse_streams_list_item(setting_sub);
const $new_row = $(html);
- if (stream_settings_components.archived_status_filter_includes_channel(sub)) {
+ if (
+ stream_settings_components.archived_status_filter_includes_channel(sub) &&
+ stream_settings_components.folder_filter_includes_channel(sub)
+ ) {
if (stream_create.get_name() === sub.name) {
scroll_util.get_content_element($(".streams-list")).prepend($new_row);
scroll_util.reset_scrollbar($(".streams-list"));
@@ -517,6 +522,7 @@ export function update_settings_for_unsubscribed(slim_sub: StreamSubscription):
function triage_stream(left_panel_params: LeftPanelParams, sub: StreamSubscription): string {
const archived_status_filters = stream_settings_data.ARCHIVED_STATUS_FILTERS;
+ const folder_filters = stream_settings_data.FOLDER_FILTERS;
if (
left_panel_params.archived_status_filter_value ===
archived_status_filters.NON_ARCHIVED_CHANNELS &&
@@ -531,6 +537,19 @@ function triage_stream(left_panel_params: LeftPanelParams, sub: StreamSubscripti
) {
return "rejected";
}
+
+ if (left_panel_params.folder_filter_value !== folder_filters.ANY_FOLDER_DROPDOWN_OPTION) {
+ if (
+ left_panel_params.folder_filter_value === folder_filters.UNCATEGORIZED_DROPDOWN_OPTION
+ ) {
+ if (sub.folder_id !== null) {
+ return "rejected";
+ }
+ } else if (sub.folder_id !== left_panel_params.folder_filter_value) {
+ return "rejected";
+ }
+ }
+
if (left_panel_params.show_subscribed && !sub.subscribed) {
// reject non-subscribed streams
return "rejected";
@@ -666,6 +685,25 @@ export function update_empty_left_panel_message(): void {
$(".no-streams-to-show").show();
}
+function update_folder_filter_button(left_panel_params: LeftPanelParams): void {
+ if (
+ left_panel_params.folder_filter_value ===
+ stream_settings_data.FOLDER_FILTERS.ANY_FOLDER_DROPDOWN_OPTION
+ ) {
+ $("#folder_filter_button").addClass("icon-button-neutral");
+ $("#folder_filter_button").removeClass("icon-button-brand");
+ $("#folder_filter_button .zulip-icon")
+ .removeClass("zulip-icon-folder-search")
+ .addClass("zulip-icon-folder-chevron");
+ } else {
+ $("#folder_filter_button").removeClass("icon-button-neutral");
+ $("#folder_filter_button").addClass("icon-button-brand");
+ $("#folder_filter_button .zulip-icon")
+ .removeClass("zulip-icon-folder-chevron")
+ .addClass("zulip-icon-folder-search");
+ }
+}
+
// LeftPanelParams { input: String, show_subscribed: Boolean, sort_order: String }
export function redraw_left_panel(left_panel_params = get_left_panel_params()): number[] {
// We only get left_panel_params passed in from tests. Real
@@ -721,6 +759,8 @@ export function redraw_left_panel(left_panel_params = get_left_panel_params()):
}
update_empty_left_panel_message();
+ update_folder_filter_button(left_panel_params);
+
// return this for test convenience
return [...buckets.name, ...buckets.desc];
}
@@ -733,6 +773,7 @@ type LeftPanelParams = {
show_available: boolean;
sort_order: string;
archived_status_filter_value: string;
+ folder_filter_value: number;
};
export function get_left_panel_params(): LeftPanelParams {
@@ -740,12 +781,14 @@ export function get_left_panel_params(): LeftPanelParams {
const input = $search_box.expectOne().val()!.trim();
const archived_status_filter_value =
stream_settings_components.get_archived_status_filter_dropdown_value();
+ const folder_filter_value = stream_settings_components.get_folder_filter_dropdown_value();
return {
input,
show_subscribed: stream_ui_updates.show_subscribed,
show_available: stream_ui_updates.show_available,
sort_order,
archived_status_filter_value,
+ folder_filter_value,
};
}
@@ -852,6 +895,101 @@ function set_up_dropdown_widget(): void {
stream_settings_components.set_archived_status_filter_dropdown_widget(widget);
}
+function set_up_folder_filter_dropdown_widget(): void {
+ const folder_filters = stream_settings_data.FOLDER_FILTERS;
+
+ const folder_options = (
+ current_value: string | number | undefined,
+ ): dropdown_widget.Option[] => {
+ const folders = channel_folders.get_folders_with_accessible_channels();
+ const options: dropdown_widget.Option[] = folders.map((folder) => ({
+ name: folder.name,
+ unique_id: folder.id,
+ bold_current_selection: current_value === folder.id,
+ }));
+
+ // Show "Uncategorized" option only if user can access at least
+ // one channel that is uncategorized.
+ const show_uncategorized_option = stream_data
+ .get_unsorted_subs()
+ .some((sub) => sub.folder_id === null);
+ if (show_uncategorized_option) {
+ const uncategorized_option = {
+ is_setting_disabled: true,
+ show_disabled_icon: false,
+ show_disabled_option_name: true,
+ unique_id: folder_filters.UNCATEGORIZED_DROPDOWN_OPTION,
+ name: $t({defaultMessage: "Uncategorized"}),
+ bold_current_selection:
+ current_value === folder_filters.UNCATEGORIZED_DROPDOWN_OPTION,
+ };
+ options.unshift(uncategorized_option);
+ }
+
+ const any_folder_option = {
+ is_setting_disabled: true,
+ show_disabled_icon: false,
+ show_disabled_option_name: true,
+ unique_id: folder_filters.ANY_FOLDER_DROPDOWN_OPTION,
+ name: $t({defaultMessage: "Any folder"}),
+ bold_current_selection: current_value === folder_filters.ANY_FOLDER_DROPDOWN_OPTION,
+ };
+ options.unshift(any_folder_option);
+
+ return options;
+ };
+
+ const widget = new dropdown_widget.DropdownWidget({
+ widget_name: "folder-filter",
+ widget_selector: ".filter-folders-dropdown-widget-button",
+ get_options: folder_options,
+ item_click_callback(
+ event: JQuery.TriggeredEvent,
+ dropdown: tippy.Instance,
+ widget: dropdown_widget.DropdownWidget,
+ ) {
+ filter_click_handler(event, dropdown, widget);
+ update_tooltip_for_folder_filter();
+ },
+ $events_container: $("#stream_filter"),
+ unique_id_type: "number",
+ default_id: folder_filters.ANY_FOLDER_DROPDOWN_OPTION,
+ });
+ widget.setup();
+ stream_settings_components.set_folder_filter_dropdown_widget(widget);
+ update_tooltip_for_folder_filter();
+}
+
+export function update_tooltip_for_folder_filter(): void {
+ // Destroy the previous tooltip instance.
+ $<tippy.PopperElement>("#folder_filter_container")[0]!._tippy?.destroy();
+
+ const folder_filters = stream_settings_data.FOLDER_FILTERS;
+ const filter_value = stream_settings_components.get_folder_filter_dropdown_value();
+
+ let content;
+ if (filter_value === folder_filters.ANY_FOLDER_DROPDOWN_OPTION) {
+ content = $t({defaultMessage: "Filter by folder"});
+ } else if (filter_value === folder_filters.UNCATEGORIZED_DROPDOWN_OPTION) {
+ content = $t({defaultMessage: "Viewing uncategorized channels"});
+ } else {
+ const folder = channel_folders.get_channel_folder_by_id(filter_value);
+ content = $t(
+ {defaultMessage: "Viewing channels in {folder_name}"},
+ {folder_name: folder.name},
+ );
+ }
+
+ tippy.default(util.the($("#folder_filter_container")), {
+ animation: false,
+ hideOnClick: false,
+ placement: "bottom",
+ appendTo: () => document.body,
+ delay: LONG_HOVER_DELAY,
+ content,
+ });
+}
+
function setup_page(callback: () => void): void {
// We should strongly consider only setting up the page once,
// but I am writing these comments write before a big release,
@@ -972,6 +1110,7 @@ function setup_page(callback: () => void): void {
$("#channels_overlay_container").append($(rendered));
set_up_dropdown_widget();
+ set_up_folder_filter_dropdown_widget();
render_left_panel_superset();
initialize_components();
redraw_left_panel();
@@ -1099,6 +1238,16 @@ export function change_state(
}
stream_settings_components.set_archived_status_filter_dropdown_value(selected_filter);
}
+ if (sub && !stream_settings_components.folder_filter_includes_channel(sub)) {
+ const folder_filters = stream_settings_data.FOLDER_FILTERS;
+ let selected_filter;
+ if (sub.folder_id === null) {
+ selected_filter = folder_filters.UNCATEGORIZED_DROPDOWN_OPTION;
+ } else {
+ selected_filter = sub.folder_id;
+ }
+ stream_settings_components.set_folder_filter_dropdown_value(selected_filter);
+ }
return;
}
diff --git a/web/src/stream_ui_updates.ts b/web/src/stream_ui_updates.ts
index ec675adab22..363ad18f767 100644
--- a/web/src/stream_ui_updates.ts
+++ b/web/src/stream_ui_updates.ts
@@ -501,7 +501,10 @@ export function update_stream_row_in_settings_tab(sub: StreamSubscription): void
!sub.subscribed &&
stream_data.can_toggle_subscription(sub))
) {
- if (stream_settings_components.archived_status_filter_includes_channel(sub)) {
+ if (
+ stream_settings_components.archived_status_filter_includes_channel(sub) &&
+ stream_settings_components.folder_filter_includes_channel(sub)
+ ) {
$row.removeClass("notdisplayed");
}
} else if (current_user.is_guest || !stream_data.can_toggle_subscription(sub)) {
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 29a4372643d..18658a5aa00 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -632,6 +632,14 @@
--user-profile-modal-body-height: 60vh;
--user-profile-modal-body-margin-bottom: 20px;
+ /* Height of the button for filter dropdown in stream settings UI.
+ It is set equal to the height of the search input, i.e. 1.4em (input
+ height with font size set to 90%) + 8px (top and bottom paddings)
+ + 2px (top and bottom borders). */
+ --folder-filter-dropdown-widget-button-height: calc(
+ 1.4 * 0.9 * var(--base-font-size-px) + 8px + 2px
+ );
+
/*
Maximum height of the compose box when it is not in maximised state. This
is equal to the height of `#bottom_whitespace`. We expect resize.ts to
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index a72f542b69a..b1cd9640c92 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -652,10 +652,22 @@ h4.user_group_setting_subsection_title {
.group_name_search_section {
padding: 8px 10px;
display: grid;
+ border-bottom: 1px solid var(--color-border-modal-bar);
+}
+
+.stream_name_search_section {
+ grid-template:
+ "folder-filter search-input clear-search dropdown-widget" auto / auto minmax(
+ 0,
+ 1fr
+ )
+ 30px;
+}
+
+.group_name_search_section {
grid-template:
"search-input clear-search dropdown-widget" auto / minmax(0, 1fr)
30px;
- border-bottom: 1px solid var(--color-border-modal-bar);
}
#stream_settings_filter_widget {
@@ -664,6 +676,31 @@ h4.user_group_setting_subsection_title {
width: auto;
}
+#clear_search_stream_name,
+#clear_search_group_name {
+ grid-area: clear-search;
+}
+
+#folder_filter_container {
+ grid-area: folder-filter;
+ display: flex;
+}
+
+#folder_filter_button {
+ font-size: calc(
+ 1.5625 * var(--base-font-size-px)
+ ); /* 25px at 16px font size */
+ padding: 0;
+ height: var(--folder-filter-dropdown-widget-button-height);
+ /* To align the search input with privacy icon box in the stream row,
+ margin is set by subtracting the button width (which is equal to
+ its height) from total width of the checkbox container in stream row. */
+ margin-right: calc(
+ 2.3125 * var(--base-font-size-px) -
+ var(--folder-filter-dropdown-widget-button-height)
+ );
+}
+
.stream_settings_filter_container.hide_filter {
display: none;
}
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index c0b19c504bf..a935677fe90 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -2352,7 +2352,8 @@ body:not(.spectator-view) {
}
.inbox-filter-dropdown-list-container,
-.recent-view-filter-dropdown-list-container {
+.recent-view-filter-dropdown-list-container,
+.folder-filter-dropdown-list-container {
overflow: visible;
.list-item {
diff --git a/web/templates/stream_settings/stream_settings_overlay.hbs b/web/templates/stream_settings/stream_settings_overlay.hbs
index 14215d46554..9619d7b5317 100644
--- a/web/templates/stream_settings/stream_settings_overlay.hbs
+++ b/web/templates/stream_settings/stream_settings_overlay.hbs
@@ -24,6 +24,11 @@
</div>
<div class="two-pane-settings-body">
<div class="input-append stream_name_search_section two-pane-settings-search" id="stream_filter">
+ <div id="folder_filter_container">
+ <button type="button" id="folder_filter_button" class="filter-folders-dropdown-widget-button icon-button icon-button-neutral" tabindex="0" aria-label="{{t 'Filter channels' }}">
+ <i class="zulip-icon zulip-icon-folder-chevron" aria-hidden="true"></i>
+ </button>
+ </div>
<input type="text" name="stream_name" id="search_stream_name" class="filter_text_input" autocomplete="off"
placeholder="{{t 'Filter' }}" value=""/>
<button type="button" class="clear_search_button" id="clear_search_stream_name">
diff --git a/web/tests/channel_folders.test.cjs b/web/tests/channel_folders.test.cjs
index e19f3c38805..27927183e48 100644
--- a/web/tests/channel_folders.test.cjs
+++ b/web/tests/channel_folders.test.cjs
@@ -168,4 +168,15 @@ run_test("basics", () => {
);
assert.deepEqual(channel_folders.user_has_folders(), true);
+
+ // Unarchive the folder for further tests.
+ devops_folder.is_archived = false;
+ assert.deepEqual(channel_folders.get_folders_with_accessible_channels(), [
+ devops_folder,
+ frontend_folder,
+ ]);
+
+ // Remove a stream to test case of an inaccessible stream.
+ stream_data.delete_sub(stream_3.stream_id);
+ assert.deepEqual(channel_folders.get_folders_with_accessible_channels(), [frontend_folder]);
});
diff --git a/web/tests/stream_settings_ui.test.cjs b/web/tests/stream_settings_ui.test.cjs
index 80a4bd537c4..632d1b170c3 100644
--- a/web/tests/stream_settings_ui.test.cjs
+++ b/web/tests/stream_settings_ui.test.cjs
@@ -230,6 +230,12 @@ run_test("redraw_left_panel", ({override, mock_template}) => {
};
stream_settings_components.set_archived_status_filters_for_tests(filters_dropdown_widget);
+ const folder_filter_dropdown_widget = {
+ render: function render() {},
+ value: () => -2,
+ };
+ stream_settings_components.set_folder_filter_for_tests(folder_filter_dropdown_widget);
+
stream_settings_ui.render_left_panel_superset();
const sub_stubs = [];