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 e3e0d025ea.
This commit is contained in:
Vinoth Kannan 2021-11-09 12:24:50 +05:30 committed by GitHub
parent 0b495e9ad4
commit d549022afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -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() {

View File

@ -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;

View File

@ -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;

View File

@ -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>