diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index cee3fcbd57f..f4bb1fdb02b 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -8,6 +8,7 @@ const Discourse = Ember.Application.extend({ _docTitle: document.title, RAW_TEMPLATES: {}, __widget_helpers: {}, + showingSignup: false, getURL(url) { if (!url) return url; diff --git a/app/assets/javascripts/discourse/routes/new-message.js.es6 b/app/assets/javascripts/discourse/routes/new-message.js.es6 index 06d929c552c..91269c4a5b0 100644 --- a/app/assets/javascripts/discourse/routes/new-message.js.es6 +++ b/app/assets/javascripts/discourse/routes/new-message.js.es6 @@ -34,7 +34,11 @@ export default Discourse.Route.extend({ }); } else { $.cookie('destination_url', window.location.href); - this.replaceWith('login'); + if (Discourse.showingSignup) { + Discourse.showingSignup = false; + } else { + self.replaceWith('login'); + } } } diff --git a/app/assets/javascripts/discourse/routes/new-topic.js.es6 b/app/assets/javascripts/discourse/routes/new-topic.js.es6 index 88dcd61368e..0459e75d4c7 100644 --- a/app/assets/javascripts/discourse/routes/new-topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/new-topic.js.es6 @@ -14,7 +14,12 @@ export default Discourse.Route.extend({ } else { // User is not logged in $.cookie('destination_url', window.location.href); - self.replaceWith('login'); + if (Discourse.showingSignup) { + // We're showing the sign up modal + Discourse.showingSignup = false; + } else { + self.replaceWith('login'); + } } } }); diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb index f9b01467938..72b3da60683 100644 --- a/app/views/common/_discourse_javascript.html.erb +++ b/app/views/common/_discourse_javascript.html.erb @@ -21,6 +21,7 @@