From 65e80aba0344f85a52e89f7de0d3b387d74b7ba8 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 24 Jan 2018 11:45:15 +0530 Subject: [PATCH] FIX: creating new message via link was failing for anon user --- app/assets/javascripts/discourse/routes/new-message.js.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/new-message.js.es6 b/app/assets/javascripts/discourse/routes/new-message.js.es6 index 91269c4a5b0..bbae55b1acf 100644 --- a/app/assets/javascripts/discourse/routes/new-message.js.es6 +++ b/app/assets/javascripts/discourse/routes/new-message.js.es6 @@ -4,10 +4,11 @@ import Group from 'discourse/models/group'; export default Discourse.Route.extend({ beforeModel(transition) { + const self = this; const params = transition.queryParams; - if (this.currentUser) { - this.replaceWith("discovery.latest").then(e => { + if (self.currentUser) { + self.replaceWith("discovery.latest").then(e => { if (params.username) { // send a message to a user User.findByUsername(params.username).then(user => {