REFACTOR: old patterns and deprecations

REFACTOR: old patterns and deprecations

diff --git a/assets/javascripts/discourse/activity-route-map.js.es6 b/assets/javascripts/discourse/activity-route-map.js.es6
index def5310..f2caf77 100644
--- a/assets/javascripts/discourse/activity-route-map.js.es6
+++ b/assets/javascripts/discourse/activity-route-map.js.es6
@@ -1,5 +1,6 @@
 export default {
   resource: "user.userActivity",
+
   map() {
     this.route("approval-given");
     this.route("approval-pending");
diff --git a/assets/javascripts/discourse/initializers/init-code-review.js.es6 b/assets/javascripts/discourse/initializers/init-code-review.js.es6
index e4ab75a..08fad59 100644
--- a/assets/javascripts/discourse/initializers/init-code-review.js.es6
+++ b/assets/javascripts/discourse/initializers/init-code-review.js.es6
@@ -5,10 +5,9 @@ import DiscourseURL from "discourse/lib/url";
 import { findAll } from "discourse/models/login-method";
 
 function actOnCommit(topic, action) {
-  const topicId = topic.get("id");
   return ajax(`/code-review/${action}.json`, {
     type: "POST",
-    data: { topic_id: topicId }
+    data: { topic_id: topic.id }
   })
     .then(result => {
       if (result.next_topic_url) {
@@ -31,18 +30,14 @@ function initialize(api) {
   // note there are slightly cleaner ways of doing this but we would need
   // to amend core for the plugin which is not feeling right
   api.modifyClass("controller:preferences/account", {
-    canUpdateAssociatedAccounts: function() {
+    canUpdateAssociatedAccounts: Ember.computed("authProviders", function() {
       return (
         findAll(this.siteSettings, this.capabilities, this.site.isMobileDevice)
           .length > 0
       );
-    }.property("authProviders")
+    })
   });
 
-  function allowUser(currentUser) {
-    return currentUser && currentUser.get("staff");
-  }
-
   function allowApprove(currentUser, topic, siteSettings) {
     if (!currentUser) {
       return false;
@@ -52,11 +47,10 @@ function initialize(api) {
     const approvedTag = siteSettings.code_review_approved_tag;
     const pendingTag = siteSettings.code_review_pending_tag;
     const followupTag = siteSettings.code_review_followup_tag;
-
-    const tags = topic.get("tags") || [];
+    const tags = topic.tags || [];
 
     return (
-      (allowSelfApprove || currentUser.get("id") !== topic.get("user_id")) &&
+      (allowSelfApprove || currentUser.id !== topic.user_id) &&
       !tags.includes(approvedTag) &&
       (tags.includes(pendingTag) || tags.includes(followupTag))
     );
@@ -67,7 +61,7 @@ function initialize(api) {
     const pendingTag = siteSettings.code_review_pending_tag;
     const followupTag = siteSettings.code_review_followup_tag;
 
-    const tags = topic.get("tags") || [];
+    const tags = topic.tags || [];
 
     return (
       !tags.includes(followupTag) &&
@@ -82,7 +76,7 @@ function initialize(api) {
     label: "code_review.approve.label",
     title: "code_review.approve.title",
     action() {
-      actOnCommit(this.get("topic"), "approve");
+      actOnCommit(this.topic, "approve");
     },
     dropdown() {
       return this.site.mobileView;
@@ -91,8 +85,8 @@ function initialize(api) {
     dependentKeys: ["topic.tags"],
     displayed() {
       return (
-        allowUser(this.currentUser) &&
-        allowApprove(this.currentUser, this.get("topic"), this.siteSettings)
+        this.get("currentUser.staff") &&
+        allowApprove(this.currentUser, this.topic, this.siteSettings)
       );
     }
   });
@@ -104,7 +98,7 @@ function initialize(api) {
     label: "code_review.followup.label",
     title: "code_review.followup.title",
     action() {
-      actOnCommit(this.get("topic"), "followup");
+      actOnCommit(this.topic, "followup");
     },
     dropdown() {
       return this.site.mobileView;
@@ -113,8 +107,8 @@ function initialize(api) {
     dependentKeys: ["topic.tags"],
     displayed() {
       return (
-        allowUser(this.currentUser) &&
-        allowFollowup(this.get("topic"), this.siteSettings)
+        this.get("currentUser.staff") &&
+        allowFollowup(this.topic, this.siteSettings)
       );
     }
   });
diff --git a/assets/javascripts/discourse/routes/user-activity-approval-given.js.es6 b/assets/javascripts/discourse/routes/user-activity-approval-given.js.es6
index 2dbea24..357f930 100644
--- a/assets/javascripts/discourse/routes/user-activity-approval-given.js.es6
+++ b/assets/javascripts/discourse/routes/user-activity-approval-given.js.es6
@@ -1,11 +1,10 @@
 import UserTopicListRoute from "discourse/routes/user-topic-list";
 
 export default UserTopicListRoute.extend({
-  model: function() {
+  model() {
+    const username = this.modelFor("user").username_lower;
     return this.store.findFiltered("topicList", {
-      filter: `topics/approval-given/${this.modelFor("user").get(
-        "username_lower"
-      )}`
+      filter: `topics/approval-given/${username}`
     });
   }
 });
diff --git a/assets/javascripts/discourse/routes/user-activity-approval-pending.js.es6 b/assets/javascripts/discourse/routes/user-activity-approval-pending.js.es6
index 6a1c1bc..b9badb9 100644
--- a/assets/javascripts/discourse/routes/user-activity-approval-pending.js.es6
+++ b/assets/javascripts/discourse/routes/user-activity-approval-pending.js.es6
@@ -1,11 +1,10 @@
 import UserTopicListRoute from "discourse/routes/user-topic-list";
 
 export default UserTopicListRoute.extend({
-  model: function() {
+  model() {
+    const username = this.modelFor("user").username_lower;
     return this.store.findFiltered("topicList", {
-      filter: `topics/approval-pending/${this.modelFor("user").get(
-        "username_lower"
-      )}`
+      filter: `topics/approval-pending/${username}`
     });
   }
 });
diff --git a/test/javascripts/acceptance/self-approve-desktop-test.js.es6 b/test/javascripts/acceptance/self-approve-desktop-test.js.es6
index 1314145..c2bb17d 100644
--- a/test/javascripts/acceptance/self-approve-desktop-test.js.es6
+++ b/test/javascripts/acceptance/self-approve-desktop-test.js.es6
@@ -11,7 +11,7 @@ acceptance("review desktop", {
 });
 
 QUnit.test("shows approve button by default", async assert => {
-  const json = $.extend(true, {}, Fixtures["/t/280/1.json"]);
+  const json = Object.assign({}, Fixtures["/t/280/1.json"]);
 
   json.tags = ["pending"];
 
diff --git a/test/javascripts/acceptance/self-approve-mobile-test.js.es6 b/test/javascripts/acceptance/self-approve-mobile-test.js.es6
index 2754e6b..cf27c9e 100644
--- a/test/javascripts/acceptance/self-approve-mobile-test.js.es6
+++ b/test/javascripts/acceptance/self-approve-mobile-test.js.es6
@@ -13,7 +13,7 @@ acceptance("review mobile", {
 });
 
 QUnit.test("shows approve button by default", async assert => {
-  const json = $.extend(true, {}, Fixtures["/t/280/1.json"]);
+  const json = Object.assign({}, Fixtures["/t/280/1.json"]);
 
   json.tags = ["pending"];

GitHub sha: b7f72515