Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream settings: Fix tooltip for sub_unsub_button on right pane.
m-e-l-u-h-a-n69b2c1143a4a
diff --git a/web/src/stream_ui_updates.js b/web/src/stream_ui_updates.jsindex 0ca00468baf..8290f18545e 100644--- a/web/src/stream_ui_updates.js+++ b/web/src/stream_ui_updates.js@@ -118,20 +118,23 @@ export function update_private_stream_privacy_option_state($container, is_defaul}export function initialize_disable_btn_hint_popover($btn_wrapper, hint_text) {- tippy($btn_wrapper[0], {- content: hint_text,+ const opts = {animation: false,hideOnClick: false,placement: "bottom",- });+ };++ // If hint_text is undefined, we use the HTML content of a+ // <template> whose id is given by data-tooltip-template-id+ if (hint_text !== undefined) {+ opts.content = hint_text;+ }+ tippy($btn_wrapper[0], opts);}export function initialize_cant_subscribe_popover() {const $button_wrapper = $(".settings .stream_settings_header .sub_unsub_button_wrapper");- initialize_disable_btn_hint_popover(- $button_wrapper,- $t({defaultMessage: "Only stream members can add users to a private stream"}),- );+ initialize_disable_btn_hint_popover($button_wrapper);}export function update_toggler_for_sub(sub) {@@ -193,10 +196,12 @@ export function update_settings_button_for_sub(sub) {$settings_button.prop("disabled", false);$settings_button.parent()[0]._tippy?.destroy();$settings_button.css("pointer-events", "");+ $settings_button.addClass("toggle-subscription-tooltip");} else {$settings_button.attr("title", "");initialize_cant_subscribe_popover();$settings_button.prop("disabled", true);+ $settings_button.removeClass("toggle-subscription-tooltip");}}diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbsindex 7867b5c5828..d12bac4e464 100644--- a/web/templates/stream_settings/stream_settings.hbs+++ b/web/templates/stream_settings/stream_settings.hbs@@ -2,8 +2,16 @@<div class="tab-container"></div>{{#with sub}}<div class="button-group">- <div class="sub_unsub_button_wrapper inline-block">- <button class="button small rounded subscribe-button sub_unsub_button {{#if should_display_subscription_button}}toggle-subscription-tooltip{{/if}} {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" {{#if should_display_subscription_button}} data-tooltip-template-id="toggle-subscription-tooltip-template" {{else}}disabled="disabled"{{/if}}>+ <div class="sub_unsub_button_wrapper inline-block {{#unless should_display_subscription_button }}cannot-subscribe-tooltip{{/unless}}" data-tooltip-template-id="cannot-subscribe-tooltip-template">+ <template id="cannot-subscribe-tooltip-template">+ <span>+ {{#tr}}+ Cannot subscribe to private stream <z-stream></z-stream>+ {{#*inline "z-stream"}}{{> ../inline_decorated_stream_name stream=../sub}}{{/inline}}+ {{/tr}}+ </span>+ </template>+ <button class="button small rounded subscribe-button sub_unsub_button {{#if should_display_subscription_button}}toggle-subscription-tooltip{{/if}} {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" data-tooltip-template-id="toggle-subscription-tooltip-template" {{#unless should_display_subscription_button}}disabled="disabled"{{/unless}}>{{#if subscribed }}{{t "Unsubscribe" }}{{else}}