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.

tooltip: Change tooltip info for default topic menu option.

Pratik Chanda1ccf5e3ac3b4
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index f66141a5bc3..ed1e82ae289 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -436,6 +436,7 @@ function format_topic(
is_topic: true,
stream_id,
topic_name: topic,
+ stream_name: stream_data.get_stream_name_from_id(stream_id),
unread_count: topic_unread_count,
conversation_key: get_topic_key(stream_id, topic),
topic_url: hash_util.by_stream_topic_url(stream_id, topic),
diff --git a/web/src/message_list_view.js b/web/src/message_list_view.js
index b0b569177e9..4666eb9cdbd 100644
--- a/web/src/message_list_view.js
+++ b/web/src/message_list_view.js
@@ -292,6 +292,7 @@ function populate_group_from_message_container(group, message_container) {
} else {
group.stream_id = sub.stream_id;
}
+ group.stream_name = stream_data.get_stream_name_from_id(sub.stream_id);
group.is_subscribed = stream_data.is_subscribed(group.stream_id);
group.topic_is_resolved = resolved_topic.is_resolved(group.topic);
group.visibility_policy = user_topics.get_topic_visibility_policy(
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index 64ca4285b80..237038b5ccf 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -11,6 +11,7 @@ import {$t} from "./i18n";
import * as people from "./people";
import * as popovers from "./popovers";
import * as settings_config from "./settings_config";
+import * as stream_data from "./stream_data";
import * as ui_util from "./ui_util";
import {user_settings} from "./user_settings";
@@ -83,11 +84,27 @@ export const topic_visibility_policy_tooltip_props = {
appendTo: () => document.body,
onShow(instance: tippy.Instance) {
const $elem = $(instance.reference);
- const current_visibility_policy_str = $elem.attr("data-tippy-content");
+ let should_render_privacy_icon;
+ let current_visibility_policy_str;
+ if ($elem.hasClass("zulip-icon-inherit")) {
+ should_render_privacy_icon = true;
+ } else {
+ should_render_privacy_icon = false;
+ current_visibility_policy_str = $elem.attr("data-tippy-content");
+ }
+ let current_stream_obj;
+ if (should_render_privacy_icon) {
+ current_stream_obj = stream_data.get_sub_by_id(
+ Number($elem.parent().attr("data-stream-id")),
+ );
+ }
+ const tooltip_context = {
+ ...current_stream_obj,
+ current_visibility_policy_str,
+ should_render_privacy_icon,
+ };
instance.setContent(
- ui_util.parse_html(
- render_change_visibility_policy_button_tooltip({current_visibility_policy_str}),
- ),
+ ui_util.parse_html(render_change_visibility_policy_button_tooltip(tooltip_context)),
);
},
onHidden(instance: tippy.Instance) {
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index 15dbd117603..869609ad74c 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -786,7 +786,25 @@ strong {
}
#change_visibility_policy_button_tooltip {
- text-align: center;
+ text-align: left;
+
+ .tooltip-privacy-icon {
+ position: relative;
+ display: inline-block;
+ }
+
+ .tooltip-privacy-icon .zulip-icon-lock {
+ margin-top: -0.15em !important;
+ }
+
+ .tooltip-privacy-icon i {
+ position: absolute;
+ top: 0.1667em;
+ }
+
+ .tooltip-privacy-icon span {
+ margin-left: 1.25em;
+ }
}
.narrow-filter {
diff --git a/web/templates/change_visibility_policy_button_tooltip.hbs b/web/templates/change_visibility_policy_button_tooltip.hbs
index 64083ba10ee..f273c03811c 100644
--- a/web/templates/change_visibility_policy_button_tooltip.hbs
+++ b/web/templates/change_visibility_policy_button_tooltip.hbs
@@ -1,4 +1,15 @@
<div id="change_visibility_policy_button_tooltip">
<strong>{{t 'Configure topic notifications' }}</strong>
- <div class="tooltip-inner-content italic">{{current_visibility_policy_str}}</div>
+ <div class="tooltip-inner-content italic">
+ <span>
+ {{#if should_render_privacy_icon}}
+ {{#tr}}
+ Notifications are based on your configuration for <z-stream-name></z-stream-name>.
+ {{#*inline "z-stream-name"}}<span class="tooltip-privacy-icon">{{> stream_privacy }}<span>{{name}}</span></span>{{/inline}}
+ {{/tr}}
+ {{else}}
+ {{current_visibility_policy_str}}
+ {{/if}}
+ </span>
+ </div>
</div>
diff --git a/web/templates/inbox_view/inbox_row.hbs b/web/templates/inbox_view/inbox_row.hbs
index c093b64d69d..6632530df9c 100644
--- a/web/templates/inbox_view/inbox_row.hbs
+++ b/web/templates/inbox_view/inbox_row.hbs
@@ -59,8 +59,8 @@
<i class="zulip-icon zulip-icon-mute-new recipient_bar_icon" data-tippy-content="{{t 'You have muted this topic.'}}"
role="button" aria-haspopup="true" aria-label="{{t 'You have muted this topic' }}"></i>
{{else if (eq visibility_policy all_visibility_policies.INHERIT)}}
- <i class="zulip-icon zulip-icon-inherit recipient_bar_icon" data-tippy-content="{{t 'You will get default notifications for this topic.'}}"
- role="button" aria-haspopup="true" aria-label="{{t 'You will get default notifications for this topic' }}"></i>
+ <i class="zulip-icon zulip-icon-inherit recipient_bar_icon"
+ role="button" aria-haspopup="true" aria-label="{{t 'Notifications are based on your configuration for #{stream_name}' }}"></i>
{{/if}}
</span>
{{/if}}
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index 854bbf99b80..41478b88604 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -71,8 +71,8 @@
<i class="zulip-icon zulip-icon-mute-new recipient_bar_icon" data-tippy-content="{{t 'You have muted this topic.'}}"
role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'You have muted this topic' }}"></i>
{{else}}
- <i class="zulip-icon zulip-icon-inherit recipient_bar_icon" data-tippy-content="{{t 'You will get default notifications for this topic.'}}"
- role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'You will get default notifications for this topic' }}"></i>
+ <i class="zulip-icon zulip-icon-inherit recipient_bar_icon"
+ role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'Notifications are based on your configuration for #{stream_name}' }}"></i>
{{/if}}
</span>
</div>
diff --git a/web/templates/recipient_row.hbs b/web/templates/recipient_row.hbs
index 293deddda78..4f6e0e9b6d1 100644
--- a/web/templates/recipient_row.hbs
+++ b/web/templates/recipient_row.hbs
@@ -70,8 +70,8 @@
<i class="zulip-icon zulip-icon-mute-new recipient_bar_icon" data-tippy-content="{{t 'You have muted this topic.'}}"
role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'You have muted this topic' }}"></i>
{{else}}
- <i class="zulip-icon zulip-icon-inherit recipient_bar_icon" data-tippy-content="{{t 'You will get default notifications for this topic.'}}"
- role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'You will get default notifications for this topic' }}"></i>
+ <i class="zulip-icon zulip-icon-inherit recipient_bar_icon"
+ role="button" tabindex="0" aria-haspopup="true" aria-label="{{t 'Notifications are based on your configuration for #{stream_name}' }}"></i>
{{/if}}
</span>
{{/if}}