FIX: Run some of the initializers even if the plugin is not activated.

FIX: Run some of the initializers even if the plugin is not activated.

These initializers must be active for passphrase modal to properly work.

diff --git a/assets/javascripts/discourse/initializers/hook-decrypt-post.js.es6 b/assets/javascripts/discourse/initializers/hook-decrypt-post.js.es6
index c45a89c..ef2457b 100644
--- a/assets/javascripts/discourse/initializers/hook-decrypt-post.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-decrypt-post.js.es6
@@ -5,7 +5,7 @@ import { renderSpinner } from "discourse/helpers/loading-spinner";
 import { iconHTML } from "discourse-common/lib/icon-library";
 import { decrypt } from "discourse/plugins/discourse-encrypt/lib/keys";
 import {
-  ENCRYPT_ACTIVE,
+  ENCRYPT_DISABLED,
   getEncryptionStatus,
   getPrivateKey,
   getTopicKey,
@@ -18,7 +18,7 @@ export default {
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
+    if (getEncryptionStatus(currentUser) === ENCRYPT_DISABLED) {
       return;
     }
 
diff --git a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6 b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
index 4f3f5ac..94c76be 100644
--- a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
@@ -4,7 +4,7 @@ import {
   hasTopicTitle,
   getTopicTitle,
   getEncryptionStatus,
-  ENCRYPT_ACTIVE
+  ENCRYPT_DISABLED
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
 
 /**
@@ -64,7 +64,7 @@ export default {
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
+    if (getEncryptionStatus(currentUser) === ENCRYPT_DISABLED) {
       return;
     }
 
diff --git a/assets/javascripts/discourse/initializers/hook-gather-keys.js.es6 b/assets/javascripts/discourse/initializers/hook-gather-keys.js.es6
index a5ebc97..6160441 100644
--- a/assets/javascripts/discourse/initializers/hook-gather-keys.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-gather-keys.js.es6
@@ -4,7 +4,7 @@ import {
   putTopicKey,
   putTopicTitle,
   getEncryptionStatus,
-  ENCRYPT_ACTIVE
+  ENCRYPT_DISABLED
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
 
 export default {
@@ -12,7 +12,7 @@ export default {
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
+    if (getEncryptionStatus(currentUser) === ENCRYPT_DISABLED) {
       return;
     }
 
diff --git a/assets/javascripts/discourse/initializers/hook-logout.js.es6 b/assets/javascripts/discourse/initializers/hook-logout.js.es6
index 1a08bd3..7fac9ff 100644
--- a/assets/javascripts/discourse/initializers/hook-logout.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-logout.js.es6
@@ -1,19 +1,11 @@
 import { deleteIndexedDb } from "discourse/plugins/discourse-encrypt/lib/keys_db";
-import {
-  ENCRYPT_ACTIVE,
-  getEncryptionStatus
-} from "discourse/plugins/discourse-encrypt/lib/discourse";
 
 export default {
   name: "hook-logout",
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
-      return;
-    }
-
-    if (!Discourse.User.current()) {
+    if (!currentUser) {
       deleteIndexedDb();
     }
   }

GitHub sha: 3f412464