Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: add support for `group_name` parameter in `/new-message` route

Arpit Jalan54338cfdcb0d
diff --git a/app/assets/javascripts/discourse/routes/new-message.js.es6 b/app/assets/javascripts/discourse/routes/new-message.js.es6
index bbae55b1acf..d3ea4fde433 100644
--- a/app/assets/javascripts/discourse/routes/new-message.js.es6
+++ b/app/assets/javascripts/discourse/routes/new-message.js.es6
@@ -6,6 +6,7 @@ export default Discourse.Route.extend({
beforeModel(transition) {
const self = this;
const params = transition.queryParams;
+ const groupName = params.groupname || params.group_name;
if (self.currentUser) {
self.replaceWith("discovery.latest").then(e => {
@@ -20,13 +21,13 @@ export default Discourse.Route.extend({
}).catch(function() {
bootbox.alert(I18n.t("generic_error"));
});
- } else if (params.groupname) {
+ } else if (groupName) {
// send a message to a group
- Group.messageable(params.groupname).then(result => {
+ Group.messageable(groupName).then(result => {
if (result.messageable) {
- Ember.run.next(() => e.send("createNewMessageViaParams", params.groupname, params.title, params.body));
+ Ember.run.next(() => e.send("createNewMessageViaParams", groupName, params.title, params.body));
} else {
- bootbox.alert(I18n.t("composer.cant_send_pm", { username: params.groupname }));
+ bootbox.alert(I18n.t("composer.cant_send_pm", { username: groupName }));
}
}).catch(function() {
bootbox.alert(I18n.t("generic_error"));