From 77b5d7ee304a688a2eb115ce04b460b43c0dd700 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 08:43:54 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/js/app.js |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index e2c8930..7dbe3b7 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1362,7 +1362,7 @@
 
     if (!aborted && this.triggerEvent('after'+command, props) === false)
       ret = false;
-    this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted });
+    this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted, ret:ret });
 
     return ret === false ? false : obj ? false : true;
   };
@@ -3477,6 +3477,12 @@
         // enable encrypted compose toggle
         this.enable_command('compose-encrypted', !is_html);
       }
+
+      // make sure to disable encryption button after toggling editor into HTML mode
+      this.addEventListener('actionafter', function(args) {
+        if (args.ret && args.action == 'toggle-editor')
+          ref.enable_command('compose-encrypted', !args.props.html);
+      });
     }
   };
 
@@ -3571,14 +3577,6 @@
 
       // list recipients with missing keys
       if (!isvalid && missing_keys.length) {
-        // load publickey.js
-        if (!$('script#publickeyjs').length) {
-          $('<script>')
-            .attr('id', 'publickeyjs')
-            .attr('src', ref.assets_path('program/js/publickey.js'))
-            .appendTo(document.body);
-        }
-
         // display dialog with missing keys
         ref.show_popup_dialog(
           ref.get_label('nopubkeyfor').replace('$email', missing_keys.join(', ')) +
@@ -4294,8 +4292,6 @@
     if (result) {
       // update internal format flag
       $("input[name='_is_html']").val(props.html ? 1 : 0);
-      // enable encrypted compose toggle
-      this.enable_command('compose-encrypted', !props.html);
     }
 
     return result;

--
Gitblit v1.9.1