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 => {