DEV: Replace use of global Ember

DEV: Replace use of global Ember

diff --git a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js
index 023e1f9..76f80c5 100644
--- a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js
+++ b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js
@@ -1,9 +1,10 @@
-import I18n from "I18n";
+import { computed, defineProperty } from "@ember/object";
 import {
   ENCRYPT_ACTIVE,
   ENCRYPT_DISABLED,
   getEncryptionStatus,
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
+import I18n from "I18n";
 
 export default {
   setupComponent(args, component) {
@@ -48,10 +49,10 @@ export default {
       },
     });
 
-    Ember.defineProperty(
+    defineProperty(
       component,
       "showEncryptControls",
-      Ember.computed(
+      computed(
         "model.isNew",
         "model.creatingPrivateMessage",
         "model.topic.encrypted_title",
@@ -70,10 +71,10 @@ export default {
     //  - the user does not have a key for the current topic
     //  - one of the recipients is a group
     //  - one of the recipients did not enable encrypt
-    Ember.defineProperty(
+    defineProperty(
       component,
       "canEncrypt",
-      Ember.computed("model.encryptError", () => {
+      computed("model.encryptError", () => {
         return !this.model.encryptError;
       })
     );
@@ -82,34 +83,29 @@ export default {
     //
     // A user cannot disable encryption when replying to an already encrypted
     // private message.
-    Ember.defineProperty(
+    defineProperty(
       component,
       "canDisableEncrypt",
-      Ember.computed("model.topic.encrypted_title", () => {
+      computed("model.topic.encrypted_title", () => {
         return !(this.model.topic && this.model.topic.encrypted_title);
       })
     );
 
     // Whether the encryption checkbox is disabled or not.
-    Ember.defineProperty(
+    defineProperty(
       component,
       "disabled",
-      Ember.computed(
-        "model.isEncrypted",
-        "canEncrypt",
-        "canDisableEncrypt",
-        () => {
-          return this.model.isEncrypted
-            ? !this.canDisableEncrypt
-            : !this.canEncrypt;
-        }
-      )
+      computed("model.isEncrypted", "canEncrypt", "canDisableEncrypt", () => {
+        return this.model.isEncrypted
+          ? !this.canDisableEncrypt
+          : !this.canEncrypt;
+      })
     );
 
-    Ember.defineProperty(
+    defineProperty(
       component,
       "title",
-      Ember.computed("model.isEncrypted", "model.encryptError", () => {
+      computed("model.isEncrypted", "model.encryptError", () => {
         if (this.model.encryptError) {
           return this.model.encryptError;
         } else if (this.model.isEncrypted) {
diff --git a/assets/javascripts/discourse/controllers/activate-encrypt.js b/assets/javascripts/discourse/controllers/activate-encrypt.js
index 762ade3..ce893c8 100644
--- a/assets/javascripts/discourse/controllers/activate-encrypt.js
+++ b/assets/javascripts/discourse/controllers/activate-encrypt.js
@@ -1,8 +1,9 @@
-import I18n from "I18n";
+import Controller from "@ember/controller";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { activateEncrypt } from "discourse/plugins/discourse-encrypt/lib/discourse";
+import I18n from "I18n";
 
-export default Ember.Controller.extend(ModalFunctionality, {
+export default Controller.extend(ModalFunctionality, {
   onShow() {
     const models = this.models || [];
     models.push(this.model);
diff --git a/assets/javascripts/discourse/controllers/export-key-pair.js b/assets/javascripts/discourse/controllers/export-key-pair.js
index d2111b0..d2c76c0 100644
--- a/assets/javascripts/discourse/controllers/export-key-pair.js
+++ b/assets/javascripts/discourse/controllers/export-key-pair.js
@@ -1,11 +1,13 @@
-import I18n from "I18n";
+import Controller from "@ember/controller";
+import { later } from "@ember/runloop";
 import copyText from "discourse/lib/copy-text";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { getIdentity } from "discourse/plugins/discourse-encrypt/lib/discourse";
 import { packIdentity } from "discourse/plugins/discourse-encrypt/lib/pack";
 import { exportIdentity } from "discourse/plugins/discourse-encrypt/lib/protocol";
+import I18n from "I18n";
 
-export default Ember.Controller.extend(ModalFunctionality, {
+export default Controller.extend(ModalFunctionality, {
   onShow() {
     this.setProperties({ inProgress: true, exported: "" });
 
@@ -31,10 +33,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
 
   actions: {
     copy() {
-      const $copyRange = $("pre.exported-key-pair");
-      if (copyText("", $copyRange[0])) {
+      const copyRange = document.querySelector("pre.exported-key-pair");
+      if (copyText("", copyRange)) {
         this.set("copied", true);
-        Ember.run.later(() => this.set("copied", false), 2000);
+        later(() => this.set("copied", false), 2000);
       }
     },
   },
diff --git a/assets/javascripts/discourse/controllers/generate-paper-key.js b/assets/javascripts/discourse/controllers/generate-paper-key.js
index d4349c3..22c0b9a 100644
--- a/assets/javascripts/discourse/controllers/generate-paper-key.js
+++ b/assets/javascripts/discourse/controllers/generate-paper-key.js
@@ -1,10 +1,11 @@
+import Controller from "@ember/controller";
 import { ajax } from "discourse/lib/ajax";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { getIdentity } from "discourse/plugins/discourse-encrypt/lib/discourse";
 import { generatePaperKey } from "discourse/plugins/discourse-encrypt/lib/paper-key";
 import { exportIdentity } from "discourse/plugins/discourse-encrypt/lib/protocol";
 
-export default Ember.Controller.extend(ModalFunctionality, {
+export default Controller.extend(ModalFunctionality, {
   onShow() {
     this.set("inProgress", true);
     const paperKey = generatePaperKey();
diff --git a/assets/javascripts/discourse/controllers/manage-paper-keys.js b/assets/javascripts/discourse/controllers/manage-paper-keys.js
index fdf5876..2183618 100644
--- a/assets/javascripts/discourse/controllers/manage-paper-keys.js
+++ b/assets/javascripts/discourse/controllers/manage-paper-keys.js
@@ -1,9 +1,10 @@
+import Controller from "@ember/controller";
 import discourseComputed from "discourse-common/utils/decorators";
 import { ajax } from "discourse/lib/ajax";
 import showModal from "discourse/lib/show-modal";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 
-export default Ember.Controller.extend(ModalFunctionality, {
+export default Controller.extend(ModalFunctionality, {
   @discourseComputed("model.encrypt_private")
   keys() {
     const keys = [];
diff --git a/assets/javascripts/discourse/controllers/reset-key-pair.js b/assets/javascripts/discourse/controllers/reset-key-pair.js
index cee9881..c6b260c 100644
--- a/assets/javascripts/discourse/controllers/reset-key-pair.js
+++ b/assets/javascripts/discourse/controllers/reset-key-pair.js
@@ -1,3 +1,4 @@
+import Controller from "@ember/controller";
 import discourseComputed from "discourse-common/utils/decorators";
 import { ajax } from "discourse/lib/ajax";
 import { popupAjaxError } from "discourse/lib/ajax-error";
@@ -5,7 +6,7 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { deleteDb } from "discourse/plugins/discourse-encrypt/lib/database";
 import { Promise } from "rsvp";
 
-export default Ember.Controller.extend(ModalFunctionality, {
+export default Controller.extend(ModalFunctionality, {
   onShow() {
     this.setProperties({
       isLoadingStats: true,
diff --git a/assets/javascripts/discourse/controllers/rotate-key-pair.js b/assets/javascripts/discourse/controllers/rotate-key-pair.js
index c0e9784..0d78b23 100644

[... diff too long, it was truncated ...]

GitHub sha: 91a40296924a6af14d8fd0165a83973524a48e26

This commit appears in #116 which was approved by eviltrout. It was merged by udan11.