From 997250586c273b25918f1614ce3cdbfc78952e27 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Mon, 1 Jul 2019 16:55:29 +0530 Subject: [PATCH] FEATURE: prefill title for direct messages from topic https://meta.discourse.org/t/default-re-title-title-for-direct-messages-from-topic/121413 --- .../javascripts/discourse/routes/application.js.es6 | 13 ++++++++----- config/locales/client.en.yml | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index 3ed2b9417e6..05435c9d26a 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 6e20a945e0a..5eff6497bc5 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 {{domain}} was already posted in the topic by @{{username}} in a reply on {{ago}} – are you sure you want to post it again?" + reference_topic_title: "RE: {{title}}" error: title_missing: "Title is required"