PERF: Disable plugin components if encryption is not active.

PERF: Disable plugin components if encryption is not active.

diff --git a/assets/javascripts/discourse/initializers/hook-decrypt-revision.js.es6 b/assets/javascripts/discourse/initializers/hook-decrypt-revision.js.es6
index c216d3f..7c2e00d 100644
--- a/assets/javascripts/discourse/initializers/hook-decrypt-revision.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-decrypt-revision.js.es6
@@ -2,7 +2,7 @@ import Post from "discourse/models/post";
 import { cookAsync } from "discourse/lib/text";
 import { decrypt } from "discourse/plugins/discourse-encrypt/lib/keys";
 import {
-  ENCRYPT_DISABLED,
+  ENCRYPT_ACTIVE,
   getEncryptionStatus,
   getTopicKey,
   hasTopicKey
@@ -13,7 +13,7 @@ export default {
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) === ENCRYPT_DISABLED) {
+    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
       return;
     }
 
diff --git a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6 b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
index 74b3f99..889fde6 100644
--- a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
@@ -5,7 +5,7 @@ import {
   hasTopicTitle,
   getTopicTitle,
   getEncryptionStatus,
-  ENCRYPT_DISABLED
+  ENCRYPT_ACTIVE
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
 
 /**
@@ -79,7 +79,7 @@ export default {
 
   initialize(container) {
     const currentUser = container.lookup("current-user:main");
-    if (getEncryptionStatus(currentUser) === ENCRYPT_DISABLED) {
+    if (getEncryptionStatus(currentUser) !== ENCRYPT_ACTIVE) {
       return;
     }

GitHub sha: 25fd65e8

1 Like