FIX: use correct attribute method to get post id from dataset. (#14845)

FIX: use correct attribute method to get post id from dataset. (#14845)

Because of this bug, the post details were not included in the PMs which are initiated from the user cards in posts. This reverts commit e3e0d025eaf1b5e9ec081b9c6668474234277a25.

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 745375d..3c64c2f 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) {
+    composePM(user, post) {
       this._close();
-      this.composePrivateMessage(user, this.topic);
+      this.composePrivateMessage(user, post);
     },
 
     cancelFilter() {
diff --git a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
index 813995f..e5f0bf1 100644
--- a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
@@ -63,7 +63,7 @@ export default Mixin.create({
     }
 
     const closestArticle = target.closest("article");
-    const postId = closestArticle ? closestArticle.dataset["post-id"] : null;
+    const postId = closestArticle ? closestArticle.dataset.postId : null;
     const wasVisible = this.visible;
     const previousTarget = this.cardTarget;
 
diff --git a/app/assets/javascripts/discourse/app/routes/application.js b/app/assets/javascripts/discourse/app/routes/application.js
index b957f9b..9ffcb39 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, topic) {
+    composePrivateMessage(user, post) {
       const recipients = user ? user.get("username") : "";
-      const reply = topic
-        ? `${window.location.protocol}//${window.location.host}${topic.url}`
+      const reply = post
+        ? `${window.location.protocol}//${window.location.host}${post.url}`
         : null;
-      const title = topic
+      const title = post
         ? I18n.t("composer.reference_topic_title", {
-            title: topic.title,
+            title: post.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 b919dda..c08cfcd 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)
+              action=(action "composePM" this.user this.post)
               icon="envelope"
               label="user.private_message"}}
             </li>

GitHub sha: d549022afbc1888a9a36335d1b81e15008645e47

This commit appears in #14845 which was approved by eviltrout. It was merged by vinothkannans.