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.

compose: Add tooltip over compose-reply button.

Maneesh Shuklab024e71dc0fe
diff --git a/web/src/compose_tooltips.ts b/web/src/compose_tooltips.ts
index e85b9725044..698d8300799 100644
--- a/web/src/compose_tooltips.ts
+++ b/web/src/compose_tooltips.ts
@@ -52,6 +52,14 @@ export function initialize(): void {
instance.setContent(pick_empty_narrow_banner().title);
return;
}
+ case "stream_disabled": {
+ instance.setContent(
+ parse_html(
+ $("#compose_disable_stream_reply_button_tooltip_template").html(),
+ ),
+ );
+ return;
+ }
case "selected_message": {
instance.setContent(
parse_html($("#compose_reply_message_button_tooltip_template").html()),
@@ -74,13 +82,19 @@ export function initialize(): void {
}
}
},
+ onTrigger(instance, event) {
+ assert(event.currentTarget instanceof HTMLElement);
+ if ($(event.currentTarget).attr("data-reply-button-type") === "stream_disabled") {
+ instance.setProps({delay: INSTANT_HOVER_DELAY});
+ }
+ },
onHidden(instance) {
instance.destroy();
},
});
tippy.delegate("body", {
- target: "#new_conversation_button",
+ target: "#compose_buttons .compose_new_conversation_button",
delay: EXTRA_LONG_HOVER_DELAY,
// Only show on mouseenter since for spectators, clicking on these
// buttons opens login modal, and Micromodal returns focus to the
@@ -88,12 +102,20 @@ export function initialize(): void {
trigger: "mouseenter",
appendTo: () => document.body,
onShow(instance) {
- const $elem = $(instance.reference);
- const conversation_type = $elem.attr("data-conversation-type");
+ const $new_conversation_button = $("#new_conversation_button");
+ const conversation_type = $new_conversation_button.attr("data-conversation-type");
if (conversation_type === "stream") {
- instance.setContent(
- parse_html($("#new_topic_message_button_tooltip_template").html()),
- );
+ if ($new_conversation_button.prop("disabled")) {
+ instance.setContent(
+ parse_html(
+ $("#compose_disable_stream_reply_button_tooltip_template").html(),
+ ),
+ );
+ } else {
+ instance.setContent(
+ parse_html($("#new_topic_message_button_tooltip_template").html()),
+ );
+ }
return undefined;
}
// Use new_stream_message_button_tooltip_template when the
diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs
index fedea786833..8c64ea3c5b4 100644
--- a/web/templates/tooltip_templates.hbs
+++ b/web/templates/tooltip_templates.hbs
@@ -10,6 +10,9 @@
{{t 'Scroll to bottom' }}
{{tooltip_hotkey_hints "End"}}
</template>
+<template id="compose_disable_stream_reply_button_tooltip_template">
+ {{t 'You do not have permission to post in this channel.' }}
+</template>
<template id="compose_reply_message_button_tooltip_template">
{{t 'Reply to selected message' }}
{{tooltip_hotkey_hints "R"}}