FIX: Include topic details when PMing

FIX: Include topic details when PMing

We used to do this and at some point regressed when we lost a reference to the post object. This restores the old behaviour.

diff --git a/app/assets/javascripts/discourse/app/components/user-card-contents.js b/app/assets/javascripts/discourse/app/components/user-card-contents.js
index 3c64c2f..745375d 100644
--- a/app/assets/javascripts/discourse/app/components/user-card-contents.js
+++ b/app/assets/javascripts/discourse/app/components/user-card-contents.js
@@ -206,9 +206,9 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
       this._close();
     },
 
-    composePM(user, post) {
+    composePM(user) {
       this._close();
-      this.composePrivateMessage(user, post);
+      this.composePrivateMessage(user, this.topic);
     },
 
     cancelFilter() {
diff --git a/app/assets/javascripts/discourse/app/routes/application.js b/app/assets/javascripts/discourse/app/routes/application.js
index a283404..c7f5511 100644
--- a/app/assets/javascripts/discourse/app/routes/application.js
+++ b/app/assets/javascripts/discourse/app/routes/application.js
@@ -70,14 +70,14 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
       });
     },
 
-    composePrivateMessage(user, post) {
+    composePrivateMessage(user, topic) {
       const recipients = user ? user.get("username") : "";
-      const reply = post
-        ? `${window.location.protocol}//${window.location.host}${post.url}`
+      const reply = topic
+        ? `${window.location.protocol}//${window.location.host}${topic.url}`
         : null;
-      const title = post
+      const title = topic
         ? I18n.t("composer.reference_topic_title", {
-            title: post.topic.title,
+            title: topic.title,
           })
         : null;
 
diff --git a/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs b/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs
index c08cfcd..b919dda 100644
--- a/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs
@@ -68,7 +68,7 @@
             <li class="compose-pm">
               {{d-button
               class="btn-primary"
-              action=(action "composePM" this.user this.post)
+              action=(action "composePM" this.user)
               icon="envelope"
               label="user.private_message"}}
             </li>

GitHub sha: e3e0d025eaf1b5e9ec081b9c6668474234277a25

This commit appears in #14772 which was approved by techAPJ. It was merged by eviltrout.