DEV: Miscellaneous code improvements.

DEV: Miscellaneous code improvements.

From 44185926f5f7e681e5dde339c5e53696374995d9 Mon Sep 17 00:00:00 2001
From: Dan Ungureanu <dan@ungureanu.me>
Date: Fri, 30 Nov 2018 00:23:11 +0200
Subject: [PATCH] DEV: Miscellaneous code improvements.


diff --git a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.hbs b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.hbs
index c4eadd6..05cb050 100644
--- a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.hbs
+++ b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.hbs
@@ -6,9 +6,9 @@
         {{#if isActive}}
           <p>{{i18n 'encrypt.preferences.status_enabled'}}</p>
           {{#if passphraseInput}}
-            <p>{{input type="password" value=old_passphrase disabled=inProgress placeholder=(i18n "encrypt.preferences.old_passphrase_placeholder")}}</p>
-            <p>{{input type="password" value=passphrase     disabled=inProgress placeholder=(i18n "encrypt.preferences.passphrase_placeholder")}}</p>
-            <p>{{input type="password" value=passphrase2    disabled=inProgress placeholder=(i18n "encrypt.preferences.passphrase2_placeholder")}}</p>
+            <p>{{input type="password" value=oldPassphrase disabled=inProgress placeholder=(i18n "encrypt.preferences.old_passphrase_placeholder")}}</p>
+            <p>{{input type="password" value=passphrase    disabled=inProgress placeholder=(i18n "encrypt.preferences.passphrase_placeholder")}}</p>
+            <p>{{input type="password" value=passphrase2   disabled=inProgress placeholder=(i18n "encrypt.preferences.passphrase2_placeholder")}}</p>
             {{#if passphraseStatus}}
               <p>{{i18n passphraseStatus}}</p>
             {{/if}}
diff --git a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6 b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
index 62b9b61..3a9ece5 100644
--- a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
+++ b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
@@ -67,6 +67,7 @@ export default {
       this.setProperties({
         passphrase: "",
         passphrase2: "",
+        oldPassphrase: "",
         passphraseInput: true
       });
     },
@@ -75,6 +76,7 @@ export default {
       this.setProperties({
         passphrase: "",
         passphrase2: "",
+        oldPassphrase: "",
         passphraseInput: false
       });
     },
@@ -183,7 +185,7 @@ export default {
       const oldPublicStr = this.get("model.custom_fields.encrypt_public_key");
       const oldPrivateStr = this.get("model.custom_fields.encrypt_private_key");
 
-      const oldPassphrase = this.get("old_passphrase");
+      const oldPassphrase = this.get("oldPassphrase");
       const passphrase = this.get("passphrase");
 
       // 1. a. Decrypt private key with old passphrase.
diff --git a/assets/javascripts/discourse/initializers/hook-composer.js.es6 b/assets/javascripts/discourse/initializers/hook-composer.js.es6
index 6c58338..4b50c73 100644
--- a/assets/javascripts/discourse/initializers/hook-composer.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-composer.js.es6
@@ -24,9 +24,6 @@ import {
 export default {
   name: "hook-composer",
   initialize(container) {
-    // Send `is_encrypted` over to the server via POST.
-    // Composer.serializeOnCreate("is_encrypted", "isEncrypted");
-
     // Decode composer on reply reload. This usually occurs when a post is
     // edited or a draft is loaded.
     const appEvents = container.lookup("app-events:main");

GitHub