Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
login_to_access_modal: Restore current hash after login.
Aman Agrawalf5e4dca8f2e2
diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.jsindex 4e1452317c1..0b2e9bcde0d 100644--- a/frontend_tests/node_tests/hash_util.js+++ b/frontend_tests/node_tests/hash_util.js@@ -210,3 +210,8 @@ run_test("test_search_public_streams_notice_url", () => {"#narrow/streams/public/sender/15-hamlet",);});++run_test("test_current_hash_as_next", () => {+ window.location.hash = "#foo";+ assert.equal(hash_util.current_hash_as_next(), "next=/#foo");+});diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 4198d337733..f57e159a934 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -44,9 +44,9 @@ import * as user_profile from "./user_profile";import * as util from "./util";export function initialize() {- // SPECATORS LOGIN TO ACCESS MODAL+ // SPECTATORS LOGIN TO ACCESS MODAL- $("body").on("click hide", ".go_back_button", (e) => {+ $("body").on("click hide", ".spectator_go_back", (e) => {browser_history.return_to_web_public_hash();$("#login_to_access_modal").modal("hide");e.preventDefault();diff --git a/static/js/hash_util.js b/static/js/hash_util.jsindex 0747bc7c533..cf550c64467 100644--- a/static/js/hash_util.js+++ b/static/js/hash_util.js@@ -308,3 +308,7 @@ export function is_web_public_compatible(hash) {return web_public_allowed_hashes.includes(main_hash);}++export function current_hash_as_next() {+ return `next=/${window.location.hash}`;+}diff --git a/static/js/login_to_access.js b/static/js/login_to_access.jsindex 7e3858580d1..d78089e56d2 100644--- a/static/js/login_to_access.js+++ b/static/js/login_to_access.js@@ -9,6 +9,7 @@ import $ from "jquery";import render_login_to_access_modal from "../templates/login_to_access.hbs";+import * as hash_util from "./hash_util";import {page_params} from "./page_params";export function show() {@@ -16,9 +17,9 @@ export function show() {// hash has changed.let login_link;if (page_params.development_environment) {- login_link = "/devlogin";+ login_link = "/devlogin/?" + hash_util.current_hash_as_next();} else {- login_link = "/login";+ login_link = "/login/?" + hash_util.current_hash_as_next();}$("#login-to-access-modal-holder").html(diff --git a/static/styles/zulip.css b/static/styles/zulip.cssindex 7c7b6a4d9e1..307cd297587 100644--- a/static/styles/zulip.css+++ b/static/styles/zulip.css@@ -2990,7 +2990,7 @@ select.inline_select_topic_edit {}#login_to_access_modal {- .go_back_button .fa {+ .spectator_go_back .fa {position: fixed;top: 11px;left: 30px;diff --git a/static/templates/login_to_access.hbs b/static/templates/login_to_access.hbsindex fd8b26976e5..af8b78867e3 100644--- a/static/templates/login_to_access.hbs+++ b/static/templates/login_to_access.hbs@@ -1,7 +1,7 @@<div id="login_to_access_modal" class="modal modal-bg fade new-style" tabindex="-1" role="dialog" aria-labelledby="login_to_access_modal" aria-hidden="true"><div class="modal-header">- <div class="color_animated_button go_back_button">+ <div class="color_animated_button spectator_go_back"><i class="fa fa-arrow-left"></i><span class="login_to_access_label"><b>{{t "Login required" }}</b></span></div>