FEATURE: prefill title for direct messages from topic

diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6
index 3ed2b94..05435c9 100644
--- a/app/assets/javascripts/discourse/routes/application.js.es6
+++ b/app/assets/javascripts/discourse/routes/application.js.es6
@@ -68,10 +68,12 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
     composePrivateMessage(user, post) {
       const recipient = user ? user.get("username") : "",
         reply = post
-          ? window.location.protocol +
-            "//" +
-            window.location.host +
-            post.get("url")
+          ? `${window.location.protocol}//${window.location.host}${post.url}`
+          : null,
+        title = post
+          ? I18n.t("composer.reference_topic_title", {
+              title: post.topic.fancyTitle
+            })
           : null;
 
       // used only once, one less dependency
@@ -80,7 +82,8 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
         usernames: recipient,
         archetypeId: "private_message",
         draftKey: "new_private_message",
-        reply: reply
+        reply,
+        title
       });
     },
 
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 6e20a94..5eff649 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1570,6 +1570,7 @@ en:
         category: "You mentioned {{username}} but they won't be notified because they do not have access to this category. You will need to add them to a group that has access to this category."
         private: "You mentioned {{username}} but they won't be notified because they are unable to see this personal message. You will need to invite them to this PM."
       duplicate_link: "It looks like your link to <b>{{domain}}</b> was already posted in the topic by <b>@{{username}}</b> in <a href='{{post_url}}'>a reply on {{ago}}</a> – are you sure you want to post it again?"
+      reference_topic_title: "RE: {{title}}"
 
       error:
         title_missing: "Title is required"

GitHub sha: 99725058

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: