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:
Zev Benjamin 2013-06-18 17:04:39 -04:00
parent 4f5b4fdb67
commit 90f4b1f227
1 changed files with 9 additions and 4 deletions

View File

@ -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,