left_sidebar: Open topic menu when clicking on follow topic icon.

Earlier, in left sidebar, clicking on followed topic icon would narrow
to the topic.

This commit introduces the ability to open topic status menu from
left sidebar from followed topic icon.

Fixes: zulip#28941.
This commit is contained in:
Pratik Chanda
2024-07-04 02:23:31 +05:30
committed by Tim Abbott
parent 72f0695e34
commit a7703e9f5f
7 changed files with 23 additions and 3 deletions

View File

@@ -678,7 +678,11 @@ export function initialize(): void {
}); });
tippy.delegate("body", { tippy.delegate("body", {
target: ["#recent_view .recipient_bar_icon", "#inbox-view .recipient_bar_icon"].join(","), target: [
"#recent_view .recipient_bar_icon",
"#inbox-view .recipient_bar_icon",
"#left-sidebar-container .visibility-policy-icon",
].join(","),
...topic_visibility_policy_tooltip_props, ...topic_visibility_policy_tooltip_props,
}); });

View File

@@ -347,6 +347,10 @@ export function initialize({
return; return;
} }
if ($(e.target).hasClass("visibility-policy-icon")) {
return;
}
const $stream_row = $(e.target).parents(".narrow-filter"); const $stream_row = $(e.target).parents(".narrow-filter");
const stream_id_string = $stream_row.attr("data-stream-id"); const stream_id_string = $stream_row.attr("data-stream-id");
assert(stream_id_string !== undefined); assert(stream_id_string !== undefined);

View File

@@ -14,6 +14,7 @@ const max_topics = 8;
const max_topics_with_unread = 12; const max_topics_with_unread = 12;
export type TopicInfo = { export type TopicInfo = {
stream_id: number;
topic_name: string; topic_name: string;
topic_resolved_prefix: string; topic_resolved_prefix: string;
topic_display_name: string; topic_display_name: string;
@@ -123,6 +124,7 @@ function choose_topics(
} }
const topic_info: TopicInfo = { const topic_info: TopicInfo = {
stream_id,
topic_name, topic_name,
topic_resolved_prefix, topic_resolved_prefix,
topic_display_name, topic_display_name,

View File

@@ -493,6 +493,7 @@
--color-message-action-visible: hsl(216deg 43% 20% / 50%); --color-message-action-visible: hsl(216deg 43% 20% / 50%);
--color-message-action-interactive: hsl(216deg 43% 20% / 100%); --color-message-action-interactive: hsl(216deg 43% 20% / 100%);
--color-message-star-action: hsl(41deg 100% 47% / 100%); --color-message-star-action: hsl(41deg 100% 47% / 100%);
--color-left-sidebar-follow-icon-hover: hsl(0deg 0% 0%);
/* The gray on the filter icons is the same as /* The gray on the filter icons is the same as
what's set on ul.filters, but with 70% opacity. */ what's set on ul.filters, but with 70% opacity. */
--color-left-sidebar-navigation-icon: hsl(0deg 0% 20% / 70%); --color-left-sidebar-navigation-icon: hsl(0deg 0% 20% / 70%);
@@ -879,6 +880,7 @@
--color-icon-bot: hsl(180deg 5% 50% / 100%); --color-icon-bot: hsl(180deg 5% 50% / 100%);
--color-message-action-visible: hsl(217deg 41% 90% / 50%); --color-message-action-visible: hsl(217deg 41% 90% / 50%);
--color-message-action-interactive: hsl(217deg 41% 90% / 100%); --color-message-action-interactive: hsl(217deg 41% 90% / 100%);
--color-left-sidebar-follow-icon-hover: hsl(0deg 0% 100%);
--color-left-sidebar-navigation-icon: hsl(0deg 0% 100% / 56%); --color-left-sidebar-navigation-icon: hsl(0deg 0% 100% / 56%);
--color-vdots-hint: hsl(0deg 0% 100% / 30%); --color-vdots-hint: hsl(0deg 0% 100% / 30%);
--color-vdots-visible: hsl(236deg 33% 80%); --color-vdots-visible: hsl(236deg 33% 80%);

View File

@@ -421,6 +421,11 @@ ul.filters {
.zulip-icon-follow { .zulip-icon-follow {
opacity: 0.6; opacity: 0.6;
&:hover {
opacity: 1;
color: var(--color-left-sidebar-follow-icon-hover);
}
} }
& li.muted_topic, & li.muted_topic,

View File

@@ -6,13 +6,13 @@
<a href="{{url}}" class="sidebar-topic-name" title="{{topic_name}}"> <a href="{{url}}" class="sidebar-topic-name" title="{{topic_name}}">
<span class="sidebar-topic-name-inner">{{topic_display_name}}</span> <span class="sidebar-topic-name-inner">{{topic_display_name}}</span>
</a> </a>
<div class="topic-markers-and-controls"> <div class="topic-markers-and-controls change_visibility_policy" data-stream-id="{{stream_id}}" data-topic-name="{{topic_name}}">
{{#if contains_unread_mention}} {{#if contains_unread_mention}}
<span class="unread_mention_info"> <span class="unread_mention_info">
@ @
</span> </span>
{{else if is_followed}} {{else if is_followed}}
<i class="zulip-icon zulip-icon-follow" aria-hidden="true"></i> <i class="zulip-icon zulip-icon-follow visibility-policy-icon" role="button" aria-hidden="true" data-tippy-content="{{t 'You follow this topic'}}"></i>
{{/if}} {{/if}}
<span class="unread_count {{#if is_zero}}zero_count{{/if}}"> <span class="unread_count {{#if is_zero}}zero_count{{/if}}">
{{unread}} {{unread}}

View File

@@ -101,6 +101,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {
topic_display_name: "topic 11", topic_display_name: "topic 11",
unread: 0, unread: 0,
is_zero: true, is_zero: true,
stream_id: 556,
is_muted: false, is_muted: false,
is_followed: false, is_followed: false,
is_unmuted_or_followed: false, is_unmuted_or_followed: false,
@@ -124,6 +125,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {
is_followed: false, is_followed: false,
is_unmuted_or_followed: false, is_unmuted_or_followed: false,
is_zero: true, is_zero: true,
stream_id: 556,
topic_display_name: "topic 9", topic_display_name: "topic 9",
topic_name: "✔ topic 9", topic_name: "✔ topic 9",
topic_resolved_prefix: "✔ ", topic_resolved_prefix: "✔ ",
@@ -138,6 +140,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {
is_followed: false, is_followed: false,
is_unmuted_or_followed: false, is_unmuted_or_followed: false,
is_zero: true, is_zero: true,
stream_id: 556,
topic_display_name: "topic 8", topic_display_name: "topic 8",
topic_name: "topic 8", topic_name: "topic 8",
topic_resolved_prefix: "", topic_resolved_prefix: "",