From 3e7e81581cfcca177744543181519a1bf64a2a78 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Fri, 22 Aug 2025 12:31:49 +0530 Subject: [PATCH] inbox: Show muted icon for muted channels. --- web/src/inbox_ui.ts | 35 ++++++++++++++++ web/styles/inbox.css | 42 +++++++++---------- .../inbox_view/inbox_stream_header_row.hbs | 5 +++ web/templates/tooltip_templates.hbs | 8 ++++ 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts index 936664d386..cc7a28de94 100644 --- a/web/src/inbox_ui.ts +++ b/web/src/inbox_ui.ts @@ -36,6 +36,7 @@ import * as pm_list from "./pm_list.ts"; import * as stream_color from "./stream_color.ts"; import * as stream_data from "./stream_data.ts"; import * as stream_list from "./stream_list.ts"; +import * as stream_settings_api from "./stream_settings_api.ts"; import * as stream_topic_history from "./stream_topic_history.ts"; import * as stream_topic_history_util from "./stream_topic_history_util.ts"; import * as sub_store from "./sub_store.ts"; @@ -2356,6 +2357,40 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}): compose_closed_ui.set_standard_text_for_reply_button(); }); + $("body").on( + "click", + "#inbox-list .toggle-channel-visibility", + function (this: HTMLElement, e) { + e.stopPropagation(); + const $elt = $(this); + focus_clicked_list_element($elt); + const stream_id = Number($elt.attr("data-stream-id")); + if (stream_id) { + const sub = sub_store.get(stream_id); + if (sub) { + stream_settings_api.set_stream_property(sub, { + property: "is_muted", + value: false, + }); + } + } + }, + ); + + $("body").on("keydown", "#inbox-list .toggle-channel-visibility", (e) => { + if (e.metaKey || e.ctrlKey) { + return; + } + + if (keydown_util.is_enter_event(e)) { + e.preventDefault(); + e.stopPropagation(); + + const $elt = $(e.currentTarget); + $elt.trigger("click"); + } + }); + $(document).on("compose_canceled.zulip", () => { if (inbox_util.is_visible()) { revive_current_focus(); diff --git a/web/styles/inbox.css b/web/styles/inbox.css index 8c381b80d3..10dc33abbc 100644 --- a/web/styles/inbox.css +++ b/web/styles/inbox.css @@ -209,27 +209,14 @@ .inbox-topic-name { grid-area: recipient_info; } + } - .inbox-right-part-wrapper { - flex-grow: 1; - - .inbox-right-part { - display: flex; - justify-content: space-between; - flex-grow: 1; - - > .inbox-action-button:first-child { - margin-left: auto; - } - } - } - - .visibility-policy-indicator { - display: flex; - align-items: center; - border-radius: 3px; - margin-left: 3px; - } + .channel-visibility-policy-indicator, + .visibility-policy-indicator { + display: flex; + align-items: center; + border-radius: 3px; + margin-left: 3px; } .unread-count-focus-outline { @@ -359,8 +346,17 @@ } .inbox-right-part-wrapper { - display: flex; - align-items: center; + flex-grow: 1; + + .inbox-right-part { + display: flex; + justify-content: space-between; + flex-grow: 1; + + > .inbox-action-button:first-child { + margin-left: auto; + } + } } .inbox-row, @@ -717,6 +713,7 @@ } } + .channel-visibility-policy-indicator, .visibility-policy-indicator { &:focus-visible { outline: 2px solid var(--color-outline-focus); @@ -741,6 +738,7 @@ on the element or one of the elements within it. */ &:focus-within:not(:focus), &:focus-visible { + .channel-visibility-policy-indicator, .inbox-row-visibility-policy-inherit, .inbox-action-button { opacity: 1; diff --git a/web/templates/inbox_view/inbox_stream_header_row.hbs b/web/templates/inbox_view/inbox_stream_header_row.hbs index 8b2887821f..c414bd337a 100644 --- a/web/templates/inbox_view/inbox_stream_header_row.hbs +++ b/web/templates/inbox_view/inbox_stream_header_row.hbs @@ -26,6 +26,11 @@
+ {{#if is_muted}} + + + + {{/if}}
diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs index d49b5a0a01..78198b8498 100644 --- a/web/templates/tooltip_templates.hbs +++ b/web/templates/tooltip_templates.hbs @@ -295,3 +295,11 @@ {{t 'Filter left sidebar' }} {{tooltip_hotkey_hints "Q"}} +