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: Don't treat folder-header unread counts as mark-as-read targets.

Evy Kassirerd31c87ce5c7d
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index 876f23b552f..92ad93b3787 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -2494,20 +2494,28 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}):
"click",
"#inbox-list .unread-count-focus-outline",
function (this: HTMLElement, e) {
- e.stopPropagation();
- e.preventDefault();
const $badge = $(this).find(".unread_count");
if ($badge.length === 0) {
return;
}
+ // This handler marks conversations as read for a DM conversation
+ // or a channel. If the badge was for neither of these (e.g. a channel
+ // folder or the full DM folder), we don't want to do anything here.
+ // Let the click fall through to the header's collapse/expand handler.
+ const user_ids_string = $badge.attr("data-user-ids-string");
+ const stream_id_string = $badge.attr("data-stream-id");
+ if (user_ids_string === undefined && stream_id_string === undefined) {
+ return;
+ }
+ e.stopPropagation();
+ e.preventDefault();
col_focus = COLUMNS.UNREAD_COUNT;
focus_clicked_list_element($(this));
- const user_ids_string = $badge.attr("data-user-ids-string");
- if (user_ids_string) {
+ if (user_ids_string !== undefined) {
unread_ops.mark_pm_as_read(user_ids_string);
return;
}
- const stream_id = Number($badge.attr("data-stream-id"));
+ const stream_id = Number(stream_id_string);
const topic = $badge.attr("data-topic-name");
if (topic !== undefined) {
unread_ops.mark_topic_as_read(stream_id, topic);
diff --git a/web/styles/inbox.css b/web/styles/inbox.css
index 33200e32850..e293f08d597 100644
--- a/web/styles/inbox.css
+++ b/web/styles/inbox.css
@@ -19,10 +19,6 @@
.unread_count {
opacity: 1;
outline: 0 solid var(--color-background-unread-counter);
-
- &:hover {
- outline-width: var(--focus-ring-width-in-views);
- }
}
.search_group {
@@ -374,6 +370,15 @@
count from affecting overall row
size as test scales up. */
align-self: stretch;
+ }
+
+ /* Channels, topics, and direct messages mark their unread
+ messages as read when their count is clicked. Folder
+ headers (channel folders and the direct messages section)
+ only show a combined count for everything inside them, so
+ they don't get the clickable affordance. */
+ :is(.inbox-row, .inbox-header:not(.inbox-folder))
+ .unread-count-focus-outline {
/* Whole 30×stretched hit area is clickable; surface
the same pointer cursor users had on the smaller
badge before the click target was expanded. */
@@ -751,12 +756,7 @@
.inbox-container #inbox-pane .inbox-folder .unread_count {
transition: none;
- cursor: default;
display: none;
-
- &:hover {
- outline: 0;
- }
}
#inbox-pane #inbox-list .collapsible-button {