From e18360056396c452f8395be26a3a6632df61741b Mon Sep 17 00:00:00 2001 From: Leo McArdle Date: Wed, 30 Aug 2017 16:58:40 +0100 Subject: [PATCH] FIX: redirect loop for new users visiting /new-topic using full screen login --- app/assets/javascripts/discourse.js.es6 | 1 + app/assets/javascripts/discourse/routes/new-message.js.es6 | 6 +++++- app/assets/javascripts/discourse/routes/new-topic.js.es6 | 7 ++++++- app/views/common/_discourse_javascript.html.erb | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) 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 @@