Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recipient_row: Add icon to copy nicely formatted topic link.
Aman Agrawald27672163bb1
diff --git a/web/src/topic_popover.ts b/web/src/topic_popover.tsindex da00d72e407..3c156c6c09d 100644--- a/web/src/topic_popover.ts+++ b/web/src/topic_popover.ts@@ -58,6 +58,30 @@ function get_conversation(instance: tippy.Instance): {}export function initialize(): void {+ $("body").on("click", ".recipient-bar-copy-link-to-topic", (e) => {+ e.preventDefault();+ e.stopPropagation();+ assert(e.currentTarget instanceof HTMLElement);+ const $copy_button = $(e.currentTarget);+ const topic_a_tag = util.the(+ $copy_button.closest(".message-header-contents").find("a.narrows_by_topic"),+ );+ assert(topic_a_tag instanceof HTMLAnchorElement);+ const topic_url = topic_a_tag.href;+ void clipboard_handler.copy_link_to_clipboard(topic_url).then(() => {+ // After copying successfully, change the tooltip text to "Copied!".+ const tippy_reference: tippy.ReferenceElement | undefined = $copy_button.get(0);+ const tippy_instance: tippy.Instance | undefined = tippy_reference!._tippy;+ if (tippy_instance) {+ tippy_instance.setContent($t_html({defaultMessage: "Copied!"}));+ tippy_instance.show();+ setTimeout(() => {+ tippy_instance.hide();+ }, 1000);+ }+ });+ });+popover_menus.register_popover_menu("#stream_filters .topic-sidebar-menu-icon, .inbox-row .inbox-topic-menu, .recipient-row-topic-menu, .recent_view_focusable .visibility-status-icon",{diff --git a/web/templates/recipient_row.hbs b/web/templates/recipient_row.hbsindex f89878082ac..83fbef75dc0 100644--- a/web/templates/recipient_row.hbs+++ b/web/templates/recipient_row.hbs@@ -64,6 +64,8 @@{{/if}}{{/if}}+ {{> components/icon_button icon="link-alt" intent="neutral" custom_classes="recipient-bar-control recipient-bar-control-icon recipient-bar-copy-link-to-topic" data-tippy-content=(t "Copy link to topic") aria-label=(t "Copy link to topic") }}+{{! visibility policy menu }}{{#if (and is_subscribed (not is_archived))}}{{!-- We define the change_visibility_policy class in a wrapper span