[evolution/gnome-3-38] I#1204 - Composer: Remove signature hints on message send



commit 1eb0078b4fc84abb0fd4870134333321dc9635bf
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 3 17:06:40 2020 +0100

    I#1204 - Composer: Remove signature hints on message send
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1204

 data/webkit/e-editor.js       | 25 +++++++++++++++++++++++--
 src/composer/e-msg-composer.c |  9 +++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index cec287d7ec..e8ace1f68c 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -2412,7 +2412,7 @@ EvoEditor.convertHtmlToSend = function()
        var html, bgcolor, text, link, vlink;
        var unsetBgcolor = false, unsetText = false, unsetLink = false, unsetVlink = false;
        var themeCss, inheritThemeColors = EvoEditor.inheritThemeColors;
-       var ii, styles, styleNode = null, topSignatureSpacers, elems;
+       var ii, styles, styleNode = null, topSignatureSpacers, signatureWrappers, signatures, signatureIds, 
elems;
 
        themeCss = EvoEditor.UpdateThemeStyleSheet(null);
        bgcolor = document.documentElement.getAttribute("x-evo-bgcolor");
@@ -2426,11 +2426,23 @@ EvoEditor.convertHtmlToSend = function()
        document.documentElement.removeAttribute("x-evo-vlink");
 
        topSignatureSpacers = document.querySelectorAll(".-x-evo-top-signature-spacer");
-
        for (ii = topSignatureSpacers.length - 1; ii >= 0; ii--) {
                topSignatureSpacers[ii].removeAttribute("class");
        }
 
+       signatureWrappers = document.querySelectorAll(".-x-evo-signature-wrapper");
+       for (ii = signatureWrappers.length - 1; ii >= 0; ii--) {
+               signatureWrappers[ii].removeAttribute("class");
+       }
+
+       signatures = document.querySelectorAll(".-x-evo-signature");
+       signatureIds = [];
+       for (ii = signatures.length - 1; ii >= 0; ii--) {
+               signatureIds[signatures.length - ii - 1] = signatures[ii].id;
+               signatures[ii].removeAttribute("class");
+               signatures[ii].removeAttribute("id");
+       }
+
        if (inheritThemeColors) {
                if (bgcolor && !document.body.getAttribute("bgcolor")) {
                        document.body.setAttribute("bgcolor", bgcolor);
@@ -2518,6 +2530,15 @@ EvoEditor.convertHtmlToSend = function()
                }
        }
 
+       for (ii = signatures.length - 1; ii >= 0; ii--) {
+               signatures[ii].className = "-x-evo-signature";
+               signatures[ii].id = signatureIds[signatures.length - ii - 1];
+       }
+
+       for (ii = signatureWrappers.length - 1; ii >= 0; ii--) {
+               signatureWrappers[ii].className = "-x-evo-signature-wrapper";
+       }
+
        if (themeCss)
                EvoEditor.UpdateThemeStyleSheet(themeCss);
 
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index 97726e7d2c..5138ba96a8 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -3121,8 +3121,13 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer)
        is_html = GPOINTER_TO_INT (
                g_object_get_data (G_OBJECT (composer), "body:text_mime_type"));
 
-       if (body != NULL)
-               set_editor_text (composer, body, is_html, FALSE);
+       if (body != NULL) {
+               const gchar *signature_uid;
+
+               signature_uid = e_composer_header_table_get_signature_uid (e_msg_composer_get_header_table 
(composer));
+
+               set_editor_text (composer, body, is_html, g_strcmp0 (signature_uid, "none") != 0);
+       }
 
        g_object_set_data (G_OBJECT (composer), "body:text", NULL);
 }


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