FEATURE: prefill title for direct messages from topic

https://meta.discourse.org/t/default-re-title-title-for-direct-messages-from-topic/121413
This commit is contained in:
Arpit Jalan 2019-07-01 16:55:29 +05:30
parent af58049eeb
commit 997250586c
2 changed files with 9 additions and 5 deletions

View File

@ -68,10 +68,12 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
composePrivateMessage(user, post) { composePrivateMessage(user, post) {
const recipient = user ? user.get("username") : "", const recipient = user ? user.get("username") : "",
reply = post reply = post
? window.location.protocol + ? `${window.location.protocol}//${window.location.host}${post.url}`
"//" + : null,
window.location.host + title = post
post.get("url") ? I18n.t("composer.reference_topic_title", {
title: post.topic.fancyTitle
})
: null; : null;
// used only once, one less dependency // used only once, one less dependency
@ -80,7 +82,8 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
usernames: recipient, usernames: recipient,
archetypeId: "private_message", archetypeId: "private_message",
draftKey: "new_private_message", draftKey: "new_private_message",
reply: reply reply,
title
}); });
}, },

View File

@ -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." 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." 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?" 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: error:
title_missing: "Title is required" title_missing: "Title is required"