From 1f82e46502934b7e2c4b53b33dc5ebb67f8e39b0 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 25 Mar 2013 14:48:01 -0400
Subject: [PATCH] Fix saving draft just after entering compose window (#1489012)

---
 CHANGELOG         |    1 +
 program/js/app.js |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 04ec31d..9d7c0d7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix saving draft just after entering compose window (#1489012)
 - Call resize handler in intervals to prevent lags and double onresize calls in Chrome (#1489005)
 - Fix javascript error in IE9 when loading form with placeholders into an iframe (#1489008)
 - Fix handling of some conditional comment tags in HTML message (#1489004)
diff --git a/program/js/app.js b/program/js/app.js
index d194b73..9e05233 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -985,8 +985,8 @@
         // Reset the auto-save timer
         clearTimeout(this.save_timer);
 
-        // compose form did not change
-        if (this.cmp_hash == this.compose_field_hash()) {
+        // compose form did not change (and draft wasn't saved already)
+        if (this.draft_saved && this.cmp_hash == this.compose_field_hash()) {
           this.auto_save_start();
           break;
         }
@@ -3302,6 +3302,7 @@
 
   this.set_draft_id = function(id)
   {
+    this.draft_saved = id;
     $("input[name='_draft_saveid']").val(id);
   };
 

--
Gitblit v1.9.1