DEV: Import User

DEV: Import User

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 ff0475b..7da9f03 100644
--- a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
+++ b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
@@ -1,5 +1,6 @@
 import { ajax } from "discourse/lib/ajax";
 import showModal from "discourse/lib/show-modal";
+import User from "discourse/models/user";
 import {
   deleteDb,
   saveDbIdentity
@@ -21,7 +22,7 @@ import {
 
 export default {
   setupComponent(args, component) {
-    const currentUser = Discourse.User.current();
+    const currentUser = User.current();
     const isCurrentUser = args.model.id === currentUser.id;
 
     component.setProperties({
diff --git a/assets/javascripts/discourse/initializers/hook-save.js.es6 b/assets/javascripts/discourse/initializers/hook-save.js.es6
index 8b6787c..1fef99c 100644
--- a/assets/javascripts/discourse/initializers/hook-save.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-save.js.es6
@@ -1,6 +1,7 @@
 import PostAdapter from "discourse/adapters/post";
 import { ajax } from "discourse/lib/ajax";
 import Topic from "discourse/models/topic";
+import User from "discourse/models/user";
 import {
   ENCRYPT_ACTIVE,
   getEncryptionStatus,
@@ -114,7 +115,7 @@ export default {
         let encryptedKeysPromise = Ember.RSVP.Promise.resolve();
         if (args.target_usernames) {
           const usernames = args.target_usernames.split(",");
-          usernames.push(Discourse.User.current().username);
+          usernames.push(User.current().username);
           const identitiesPromise = getUserIdentities(usernames);
 
           encryptedKeysPromise = Ember.RSVP.Promise.all([
diff --git a/test/javascripts/acceptance/encrypt-test.js.es6 b/test/javascripts/acceptance/encrypt-test.js.es6
index 1c997f2..405dde3 100644
--- a/test/javascripts/acceptance/encrypt-test.js.es6
+++ b/test/javascripts/acceptance/encrypt-test.js.es6
@@ -1,3 +1,4 @@
+import User from "discourse/models/user";
 import {
   deleteDb,
   loadDbIdentity,
@@ -64,7 +65,7 @@ let requests = [];
  * @param status
  */
 async function setEncryptionStatus(status) {
-  const user = Discourse.User.current();
+  const user = User.current();
 
   // Resetting IndexedDB.
   try {
@@ -118,7 +119,7 @@ async function wait(statusOrWaiter, func) {
   const waiter =
     typeof statusOrWaiter === "function"
       ? statusOrWaiter
-      : () => getEncryptionStatus(Discourse.User.current()) === statusOrWaiter;
+      : () => getEncryptionStatus(User.current()) === statusOrWaiter;
 
   try {
     Ember.Test.registerWaiter(waiter);

GitHub sha: f2a4633e

1 Like