From dbe4eff8d2377e3a1f4292ecbef25d8a4d7eab18 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Thu, 10 Apr 2014 10:59:40 -0400
Subject: [PATCH] Avoid unexpected redirects to inbox after auto-saving a draft (#1489789)
---
program/js/app.js | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index eb86aa9..be937c0 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3638,9 +3638,12 @@
$("input[name='_draft_saveid']").val(id);
// reset history of hidden iframe used for saving draft (#1489643)
- if (window.frames['savetarget'] && window.frames['savetarget'].history) {
+ // but don't do this on timer-triggered draft-autosaving (#1489789)
+ if (window.frames['savetarget'] && window.frames['savetarget'].history && !this.draft_autosave_submit) {
window.frames['savetarget'].history.back();
}
+
+ this.draft_autosave_submit = false;
}
// always remove local copy upon saving as draft
@@ -3650,7 +3653,11 @@
this.auto_save_start = function()
{
if (this.env.draft_autosave)
- this.save_timer = setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000);
+ this.draft_autosave_submit = false;
+ this.save_timer = setTimeout(function(){
+ ref.draft_autosave_submit = true; // set auto-saved flag (#1489789)
+ ref.command("savedraft");
+ }, this.env.draft_autosave * 1000);
// save compose form content to local storage every 5 seconds
if (!this.local_save_timer && window.localStorage) {
--
Gitblit v1.9.1