inbox: Alter dropdown text for channel view.

This commit is contained in:
Aman Agrawal
2025-06-12 14:56:46 +05:30
committed by Tim Abbott
parent e2fa1e6fa4
commit 365f3cdeb9
2 changed files with 19 additions and 3 deletions

View File

@@ -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();
}

View File

@@ -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,
},
];