Merge pull request #5120 from LeoMcA/new-topic-redirect-loop

FIX: redirect loop for new users visiting /new-topic using full screen login
This commit is contained in:
Arpit Jalan 2017-09-08 08:53:24 +05:30 committed by GitHub
commit 164a388dcc
4 changed files with 13 additions and 2 deletions

View File

@ -8,6 +8,7 @@ const Discourse = Ember.Application.extend({
_docTitle: document.title,
RAW_TEMPLATES: {},
__widget_helpers: {},
showingSignup: false,
getURL(url) {
if (!url) return url;

View File

@ -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');
}
}
}

View File

@ -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');
}
}
}
});

View File

@ -21,6 +21,7 @@
<script>
<%- if !current_user && flash[:authentication_data] %>
Discourse.showingSignup = true
require('discourse/routes/application').default.reopen({
actions: {
didTransition: function() {