From 29ba9311e62c1c44eebaf75d8de26c269f3eb1c9 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Thu, 13 Aug 2020 11:33:58 +1000 Subject: [PATCH] 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 ee3a71fd..6a1921a6 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);