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.
This commit is contained in:
Robin Ward 2021-10-29 11:48:44 -04:00
parent cfc62dbace
commit e3e0d025ea
3 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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