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.

left_sidebar: Respect unread display settings on STREAMS header.

Karl Stolleya376954a7a23
diff --git a/web/src/sidebar_ui.js b/web/src/sidebar_ui.js
index fc860fb54b3..4456c70a331 100644
--- a/web/src/sidebar_ui.js
+++ b/web/src/sidebar_ui.js
@@ -144,6 +144,7 @@ export function initialize_left_sidebar() {
user_settings.web_home_view === settings_config.web_home_view_values.all_messages.code,
is_recent_view_home_view:
user_settings.web_home_view === settings_config.web_home_view_values.recent_topics.code,
+ hide_unread_counts: settings_data.should_mask_unread_count(),
});
$("#left-sidebar-container").html(rendered_sidebar);
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index 9c14dfcad10..8fdfb8ecd6f 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -1268,6 +1268,38 @@ li.topic-list-item {
padding: 0;
}
}
+
+ &.hide_unread_counts {
+ .unread_count,
+ .unread_count.hide,
+ .masked_unread_count {
+ display: none;
+ }
+
+ /* When an empty unread count is hidden,
+ hide the masked unread count, too. */
+ .unread_count.hide + .masked_unread_count {
+ display: none;
+ }
+
+ .masked_unread_count {
+ display: block;
+ /* Hold space enough so single-digit
+ unreads don't shift on hover. */
+ margin: 0 3px;
+ }
+
+ &:hover {
+ .unread_count {
+ display: block;
+ }
+
+ .hide,
+ .masked_unread_count {
+ display: none;
+ }
+ }
+ }
}
.streams_subheader {
diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs
index ea043c23fd3..7dd70c1dbce 100644
--- a/web/templates/left_sidebar.hbs
+++ b/web/templates/left_sidebar.hbs
@@ -157,7 +157,7 @@
</div>
<div id="streams_list" class="zoom-out">
- <div id="streams_header" class="zoom-in-hide">
+ <div id="streams_header" class="zoom-in-hide {{#if hide_unread_counts}}hide_unread_counts{{/if}}">
<h4 class="left-sidebar-title"><span class="streams-tooltip-target" data-tooltip-template-id="filter-streams-tooltip-template">{{t 'STREAMS' }}</span></h4>
<div class="heading-markers-and-controls">
<i id="filter_streams_tooltip" class="streams_filter_icon fa fa-filter" aria-hidden="true" data-tooltip-template-id="filter-streams-tooltip-template"></i>
@@ -165,6 +165,7 @@
<i id="streams_inline_icon" class='fa fa-plus' aria-hidden="true" ></i>
</span>
<span class="unread_count"></span>
+ <span class="masked_unread_count"></span>
</div>
<div class="input-append notdisplayed stream_search_section">