[geary/mjog/composer-context-loading-fixes: 14/14] Composer.Widget: Handle non-Geary HTML and plain text drafts better




commit 48e16c8c8f745b3325295d3148f9f6f80167ecaa
Author: Michael Gratton <mike vee net>
Date:   Thu Aug 13 11:33:58 2020 +1000

    Composer.Widget: Handle non-Geary HTML and plain text drafts better
    
    Commit 37d904b5 added a partial change to how drafts are saved and
    loaded - saving plain text only when not in rich text mode and
    loading HTML-based drafts that don't seem to have originated from Geary
    and plain-text-only drafts as the body so that Geary's composer-internal
    HTML markup is still present.
    
    However this introduced a double signature when loading plain text
    drafts back since Geary would assume the body (including sig) is the
    message body and appending a new sig to that.
    
    This addresses the issue above by always saving drafts with HTML parts
    even when in plain text only mode.

 src/client/composer/composer-widget.vala | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index ee3a71fd3..6a1921a67 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -882,7 +882,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
         }
         update_extended_headers();
 
-        yield finish_loading(body, complete_quote, (type == EDIT));
+        yield finish_loading(body, complete_quote, body_complete);
     }
 
     /**
@@ -1407,12 +1407,12 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
 
         try {
             email.body_text = yield this.editor.get_text();
-            if (this.editor.is_rich_text) {
-                email.body_html = (
-                    for_draft
-                    ? yield this.editor.get_html_for_draft()
-                    : yield this.editor.get_html()
-                );
+            if (for_draft) {
+                // Must save HTML even if in plain text mode since we
+                // need it to restore body/sig/reply state
+                email.body_html = yield this.editor.get_html_for_draft();
+            } else if (this.editor.is_rich_text) {
+                email.body_html = yield this.editor.get_html();
             }
         } catch (Error error) {
             debug("Error getting composer message body: %s", error.message);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]