mirror of https://github.com/zulip/zulip.git
Preserve the hash when reloading
Previously, if you were narrowed when we reloaded you, you'd be kicked out to the home view. (imported from commit c00f1b92c9a4f559998463e141a402b69873fd56)
This commit is contained in:
parent
4f5b4fdb67
commit
90f4b1f227
|
@ -27,7 +27,13 @@ function preserve_compose(send_after_reload) {
|
|||
url += "+msg_type=private";
|
||||
url += "+recipient=" + encodeURIComponent(compose.recipient());
|
||||
}
|
||||
url += "+msg="+ encodeURIComponent(compose.message_content());
|
||||
url += "+msg=" + encodeURIComponent(compose.message_content());
|
||||
|
||||
var oldhash = window.location.hash;
|
||||
if (oldhash.length !== 0 && oldhash[0] === '#') {
|
||||
oldhash = oldhash.slice(1);
|
||||
}
|
||||
url += "+oldhash=" + encodeURIComponent(oldhash);
|
||||
|
||||
window.location.replace(url);
|
||||
}
|
||||
|
@ -40,9 +46,6 @@ $(function () {
|
|||
if (fragment.search("reload:") !== 0) {
|
||||
return;
|
||||
}
|
||||
window.location.hash = '';
|
||||
util.reset_favicon();
|
||||
|
||||
fragment = fragment.replace(/^reload:/, "");
|
||||
var keyvals = fragment.split("+");
|
||||
var vars = {};
|
||||
|
@ -59,6 +62,8 @@ $(function () {
|
|||
|
||||
var send_now = parseInt(vars.send_after_reload, 10);
|
||||
|
||||
hashchange.changehash(vars.oldhash);
|
||||
|
||||
// TODO: preserve focus
|
||||
compose.start(vars.msg_type, {stream: vars.stream,
|
||||
subject: vars.subject,
|
||||
|
|
Loading…
Reference in New Issue