buddy_list: Use hide classname instead of user-with-count.

There seem to be two different ways of making the unread
marker visible:

(1) `user-with-count` classname on the `user_sidebar_entry`
element, which is added on render and not modified after
render at all.

(2) `hide` classname, which is toggled on the `unread_count`
element in `update_unread_count_in_dom`.

This creates a bug where sometimes the buddy list doesn't
update when messages are marked unread. This actually
doesn't always happen, since if there was an unread marker
that was there on the original render (and then removed
and put back) it will display again.

This commit keeps the `hide` class and removes the
`user-with-count` strategy.
This commit is contained in:
evykassirer 2024-03-23 12:18:32 -07:00 committed by Tim Abbott
parent 51ed6a4d7b
commit ad35d2a487
2 changed files with 3 additions and 3 deletions

View File

@ -273,7 +273,7 @@ $user_status_emoji_width: 24px;
margin-top: 2.5px;
}
&.user-with-count .unread_count {
.unread_count:not(.hide) {
display: block;
margin-left: 4px;

View File

@ -1,4 +1,4 @@
<li data-user-id="{{user_id}}" class="user_sidebar_entry {{#if is_current_user}}user_sidebar_entry_me {{/if}}{{#if num_unread}} user-with-count {{/if}} narrow-filter {{#if faded}} user-fade {{/if}}">
<li data-user-id="{{user_id}}" class="user_sidebar_entry {{#if is_current_user}}user_sidebar_entry_me {{/if}} narrow-filter {{#if faded}} user-fade {{/if}}">
<div class="selectable_sidebar_block">
<span class="{{user_circle_class}} user_circle"></span>
<a class="user-presence-link"
@ -18,7 +18,7 @@
{{> status_emoji status_emoji_info}}
{{/if}}
</a>
<span class="unread_count">{{#if num_unread}}{{num_unread}}{{/if}}</span>
<span class="unread_count {{#unless num_unread}}hide{{/unless}}">{{#if num_unread}}{{num_unread}}{{/if}}</span>
</div>
<span class="sidebar-menu-icon user-list-sidebar-menu-icon"><i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i></span>
</li>