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.

inbox: Alter dropdown text for channel view.

Aman Agrawal365f3cdeb911
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index 230f4b6e0bd..f66d4952310 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -965,6 +965,12 @@ function render_channel_view(channel_id: number): void {
channel_view_topic_widget.build();
}
+function inbox_view_dropdown_options(
+ current_value: string | number | undefined,
+): dropdown_widget.Option[] {
+ return views_util.filters_dropdown_options(current_value, inbox_util.is_channel_view());
+}
+
export function complete_rerender(): void {
if (!inbox_util.is_visible()) {
return;
@@ -1023,6 +1029,7 @@ export function complete_rerender(): void {
item_click_callback: filter_click_handler,
$events_container: $("#inbox-main"),
default_id: first_filter.done ? undefined : first_filter.value,
+ get_options: inbox_view_dropdown_options,
});
filters_dropdown_widget.setup();
}
diff --git a/web/src/views_util.ts b/web/src/views_util.ts
index 1c0714e7bf3..6d4b2e6a9da 100644
--- a/web/src/views_util.ts
+++ b/web/src/views_util.ts
@@ -40,8 +40,17 @@ export const COMMON_DROPDOWN_WIDGET_PARAMS = {
disable_for_spectators: true,
} satisfies Partial<dropdown_widget.DropdownWidgetOptions>;
+const ALL_TOPICS_OPTION_DESCRIPTION = $t({
+ defaultMessage: "Includes muted channels and topics",
+});
+
+const ALL_TOPICS_OPTION_DESCRIPTION_FOR_CHANNEL_VIEW = $t({
+ defaultMessage: "Includes muted topics",
+});
+
export function filters_dropdown_options(
current_value: string | number | undefined,
+ channel_view = false,
): dropdown_widget.Option[] {
return [
{
@@ -59,9 +68,9 @@ export function filters_dropdown_options(
{
unique_id: FILTERS.ALL_TOPICS,
name: $t({defaultMessage: "All topics"}),
- description: $t({
- defaultMessage: "Includes muted channels and topics",
- }),
+ description: channel_view
+ ? ALL_TOPICS_OPTION_DESCRIPTION_FOR_CHANNEL_VIEW
+ : ALL_TOPICS_OPTION_DESCRIPTION,
bold_current_selection: current_value === FILTERS.ALL_TOPICS,
},
];