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.

stream_settings: Disable "Generate Channel Email" button with a tooltip.

Prakhar Pratyusha639bc03a524
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index df0c516b900..a090778901c 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -664,4 +664,13 @@ export function initialize(): void {
instance.destroy();
},
});
+
+ tippy.delegate("body", {
+ target: ".generate-channel-email-button-container.disabled_setting_tooltip",
+ content: $t({defaultMessage: "You do not have permission to post in this channel."}),
+ appendTo: () => document.body,
+ onHidden(instance) {
+ instance.destroy();
+ },
+ });
}
diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbs
index b347dbf3495..314bbfb6194 100644
--- a/web/templates/stream_settings/stream_settings.hbs
+++ b/web/templates/stream_settings/stream_settings.hbs
@@ -86,18 +86,18 @@
{{stream_id}}
</div>
{{/with}}
- {{#if can_access_stream_email}}
<div class="input-group stream-email-box">
<label for="copy_stream_email_button" class="title inline-block">Email address</label>
<p class="field-hint">
{{t "You can use email to send messages to Zulip channels."}}
{{> ../help_link_widget link="/help/message-a-channel-by-email" }}
</p>
- <button class="button small rounded copy_email_button" id="copy_stream_email_button" type="button">
- <span class="copy_button">{{t "Generate email address" }}</span>
- </button>
+ <span class="generate-channel-email-button-container {{#unless can_access_stream_email}}disabled_setting_tooltip{{/unless}}">
+ <button class="button small rounded copy_email_button" {{#unless can_access_stream_email}}disabled="disabled"{{/unless}} id="copy_stream_email_button" type="button">
+ <span class="copy_button">{{t "Generate email address" }}</span>
+ </button>
+ </span>
</div>
- {{/if}}
</div>
</div>