channel_feed: Configure click event for channel name.

This commit configures the click event on the channel name so that
when the user is narrowed to a topic within a channel, clicking the
same channel will navigate the user to the general channel feed. This
improves the user experience by allowing easy access to the full
channel feed when a user is focused on a specific topic.

Fixes #32032.
This commit is contained in:
Aditya Chaudhary 2024-10-24 03:32:47 +05:30 committed by Tim Abbott
parent 2671a5c32c
commit c1fc8e6331
1 changed files with 8 additions and 0 deletions

View File

@ -846,6 +846,14 @@ export function set_event_handlers({
e.stopPropagation(); e.stopPropagation();
const stream_id = stream_id_for_elt($(e.target).parents("li")); const stream_id = stream_id_for_elt($(e.target).parents("li"));
const current_narrow_stream_id = narrow_state.stream_id();
const current_topic = narrow_state.topic();
if (current_narrow_stream_id === stream_id && current_topic) {
const channel_feed_url = hash_util.by_stream_url(stream_id);
browser_history.go_to_location(channel_feed_url);
return;
}
if ( if (
user_settings.web_channel_default_view === user_settings.web_channel_default_view ===