UX: use share modal in dominating topic msg (#13837)

UX: use share modal in dominating topic msg (#13837)

diff --git a/app/assets/javascripts/discourse/app/components/composer-messages.js b/app/assets/javascripts/discourse/app/components/composer-messages.js
index a2ae8b9..e5f1ae9 100644
--- a/app/assets/javascripts/discourse/app/components/composer-messages.js
+++ b/app/assets/javascripts/discourse/app/components/composer-messages.js
@@ -4,6 +4,7 @@ import I18n from "I18n";
 import LinkLookup from "discourse/lib/link-lookup";
 import { not } from "@ember/object/computed";
 import { scheduleOnce } from "@ember/runloop";
+import showModal from "discourse/lib/show-modal";
 
 let _messagesCache = {};
 
@@ -72,6 +73,19 @@ export default Component.extend({
         messagesByTemplate[templateName] = message;
       }
     },
+
+    shareModal() {
+      const { topic } = this.composer;
+      const controller = showModal("share-topic");
+      controller.setProperties({
+        allowInvites:
+          topic.details.can_invite_to &&
+          !topic.archived &&
+          !topic.closed &&
+          !topic.deleted,
+        topic: topic,
+      });
+    },
   },
 
   // Resets all active messages.
diff --git a/app/assets/javascripts/discourse/app/templates/components/composer-messages.hbs b/app/assets/javascripts/discourse/app/templates/components/composer-messages.hbs
index dbb104f..4d40a74 100644
--- a/app/assets/javascripts/discourse/app/templates/components/composer-messages.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/composer-messages.hbs
@@ -1,3 +1,3 @@
 {{#each messages as |message|}}
-  {{composer-message message=message closeMessage=(action "closeMessage")}}
+  {{composer-message message=message closeMessage=(action "closeMessage") shareModal=(action "shareModal")}}
 {{/each}}
diff --git a/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs b/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs
index 63be2ba..c76de1b 100644
--- a/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs
@@ -1,11 +1,12 @@
 <a href {{action closeMessage message}} class="close">{{d-icon "times"}}</a>
+
 {{html-safe message.body}}
 
 {{#if currentUser.can_invite_to_forum}}
   {{d-button
     class="btn-primary"
-    label="topic.invite_reply.title"
-    icon="user-friends"
-    action=(route-action "showInvite")
+    label="footer_nav.share"
+    icon="link"
+    action=(action shareModal)
   }}
 {{/if}}

GitHub sha: 668272387dfa9370051b646cba5a18a2169fa2ca

This commit appears in #13837 which was approved by CvX. It was merged by awesomerobot.