From 9303ba49787b8bdc4961d7d2276ff34891dfb834 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 13 Feb 2020 12:10:12 +0100 Subject: [PATCH] Fixed saving unchanged drafts --- .../java/eu/faircode/email/FragmentCompose.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index cae5b9f961..05f97e477c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -3654,14 +3654,19 @@ public class FragmentCompose extends FragmentBase { String p = Helper.readText(draft.getFile(context)); Document doc = JsoupEx.parse(p); - if ((body != null && !body.equals(doc.html())) || + doc.select("div[fairemail=signature]").remove(); + Elements ref = doc.select("div[fairemail=reference]"); + ref.remove(); + + if (body == null) + body = Document.createShell("").html(); + Document b = HtmlHelper.sanitize(context, body, true, false); + body = b.html(); + + if (!b.body().html().equals(doc.body().html()) || (extras != null && extras.containsKey("html"))) { dirty = true; - doc.select("div[fairemail=signature]").remove(); - Elements ref = doc.select("div[fairemail=reference]"); - ref.remove(); - boolean signature_end = prefs.getBoolean("signature_end", false); // Get saved body @@ -3741,7 +3746,7 @@ public class FragmentCompose extends FragmentBase { action == R.id.action_undo || action == R.id.action_redo || action == R.id.action_check) { - if (BuildConfig.DEBUG || dirty) + if (dirty) EntityOperation.queue(context, draft, EntityOperation.ADD); if (action == R.id.action_check) {