left_sidebar: Add navigation option to go to top unread topic.

This commit adds option in personal settings to allow
navigation of channel links in left sidebar to the top
unread topic in that channel.

In cases of no unread messages in unmuted topics of the channel,
it falls back to the top topic of channel.

Fixes #35066
This commit is contained in:
Rohan Gudimetla
2025-07-01 18:31:31 +05:30
committed by Tim Abbott
parent 35bc9d37f1
commit a3e7ef8e71
9 changed files with 62 additions and 12 deletions

View File

@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 11.0
**Feature level 401**
* [`POST /register`](/api/register-queue), [`PATCH
/settings`](/api/update-settings), [`PATCH
/realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):
Added new option in user setting `web_channel_default_view`, to navigate
to top unread topic in channel.
**Feature level 400**
* [Markdown message formatting](/api/message-formatting#links-to-channels-topics-and-messages):

View File

View File

@@ -1,6 +1,6 @@
You can configure whether channel links in the [left
sidebar](/help/left-sidebar) go to the channel feed, a list of topics in the
channel, or to the top topic.
channel, the top topic, or the top unread topic.
{start_tabs}

View File

@@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 400
API_FEATURE_LEVEL = 401
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump

View File

@@ -67,6 +67,10 @@ export const web_channel_default_view_values = {
code: 1,
description: $t({defaultMessage: "Top topic in the channel"}),
},
top_unread_topic_in_channel: {
code: 4,
description: $t({defaultMessage: "Top unread topic in the channel"}),
},
list_of_topics: {
code: 3,
description: $t({defaultMessage: "List of topics"}),

View File

@@ -38,6 +38,7 @@ import * as ui_util from "./ui_util.ts";
import * as unread from "./unread.ts";
import type {FullUnreadCountsData, StreamCountInfo} from "./unread.ts";
import {user_settings} from "./user_settings.ts";
import * as user_topics from "./user_topics.ts";
let pending_stream_list_rerender = false;
let zoomed_in = false;
@@ -944,7 +945,27 @@ export function set_event_handlers({
false,
(topic_names: string[]) => topic_names,
);
const topic_item = topic_list_info.items[0];
// This initial value handles both the
// top_topic_in_channel mode as well as the
// top_unread_topic_in_channel fallback when there are no
// (unmuted) unreads in the channel.
let topic_item = topic_list_info.items[0];
if (
user_settings.web_channel_default_view ===
web_channel_default_view_values.top_unread_topic_in_channel.code
) {
for (const topic_list_item of topic_list_info.items) {
if (
unread.topic_has_any_unread(stream_id, topic_list_item.topic_name) &&
!user_topics.is_topic_muted(stream_id, topic_list_item.topic_name)
) {
topic_item = topic_list_item;
break;
}
}
}
if (topic_item !== undefined) {
const destination_url = hash_util.by_channel_topic_permalink(
stream_id,

View File

@@ -134,11 +134,13 @@ class UserBaseSettings(models.Model):
WEB_CHANNEL_DEFAULT_VIEW_FIRST_TOPIC = 1
WEB_CHANNEL_DEFAULT_VIEW_CHANNEL_FEED = 2
WEB_CHANNEL_DEFAULT_VIEW_TOPIC_LIST = 3
WEB_CHANNEL_DEFAULT_VIEW_TOP_UNREAD = 4
WEB_CHANNEL_DEFAULT_VIEW_CHOICES = [
WEB_CHANNEL_DEFAULT_VIEW_FIRST_TOPIC,
WEB_CHANNEL_DEFAULT_VIEW_TOPIC_LIST,
WEB_CHANNEL_DEFAULT_VIEW_CHANNEL_FEED,
WEB_CHANNEL_DEFAULT_VIEW_TOP_UNREAD,
]
web_channel_default_view = models.SmallIntegerField(

View File

@@ -13326,9 +13326,12 @@ paths:
- 1 - Top topic in the channel
- 2 - Channel feed
- 3 - List of topics
- 4 - Top unread topic in channel
**Changes**: The "List of topics" option is new in
Zulip 11.0 (feature level 383).
**Changes**: The "Top unread topic in channel" is new in Zulip 11.0
(feature level 401).
The "List of topics" option is new in Zulip 11.0 (feature level 383).
New in Zulip 9.0 (feature level 269). Previously, this
was not configurable, and every user had the "Channel feed" behavior.
@@ -13338,6 +13341,7 @@ paths:
- 1
- 2
- 3
- 4
example: 1
web_font_size_px:
description: |
@@ -16795,9 +16799,12 @@ paths:
- 1 - Top topic in the channel
- 2 - Channel feed
- 3 - List of topics
- 4 - Top unread topic in channel
**Changes**: The "List of topics" option is new in
Zulip 11.0 (feature level 383).
**Changes**: The "Top unread topic in channel" is new in Zulip 11.0
(feature level 401).
The "List of topics" option is new in Zulip 11.0 (feature level 383).
New in Zulip 9.0 (feature level 269). Previously, this
was not configurable, and every user had the "Channel feed" behavior.
@@ -19598,9 +19605,13 @@ paths:
- 1 - Top topic in the channel
- 2 - Channel feed
- 3 - List of topics
- 4 - Top unread topic in channel
**Changes**: In Zulip 11.0 (feature level 383), we added a new option
"List of topics" to this setting.
**Changes**: The "Top unread topic in channel" is new in Zulip 11.0
(feature level 401).
In Zulip 11.0 (feature level 383), we added a new option "List of topics"
to this setting.
New in Zulip 9.0 (feature level 269). Previously, this
was not configurable, and every user had the "Channel feed" behavior.
@@ -20775,9 +20786,12 @@ paths:
- 1 - Top topic in the channel
- 2 - Channel feed
- 3 - List of topics
- 4 - Top unread topic in channel
**Changes**: The "List of topics" option is new in
Zulip 11.0 (feature level 383).
**Changes**: The "Top unread topic in channel" is new in Zulip 11.0
(feature level 401).
The "List of topics" option is new in Zulip 11.0 (feature level 383).
New in Zulip 9.0 (feature level 269). Previously, this
was not configurable, and every user had the "Channel feed" behavior.
@@ -20785,6 +20799,7 @@ paths:
enum:
- 1
- 2
- 4
example: 1
starred_message_counts:
description: |

View File

@@ -4764,7 +4764,7 @@ class UserDisplayActionTest(BaseAction):
web_home_view=["all_messages", "inbox", "recent_topics"],
demote_inactive_streams=[2, 3, 1],
web_mark_read_on_scroll_policy=[2, 3, 1],
web_channel_default_view=[2, 1, 3],
web_channel_default_view=[2, 1, 3, 4],
user_list_style=[1, 2, 3],
web_animate_image_previews=["always", "on_hover", "never"],
web_stream_unreads_count_display_policy=[1, 2, 3],