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.
This commit is contained in:
Michael Gratton 2020-08-13 11:33:58 +10:00 committed by Michael James Gratton
parent 44654e3f76
commit 29ba9311e6

View file

@ -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);