REFACTOR: old ember patterns, deprecations, dead code (#42)

REFACTOR: old ember patterns, deprecations, dead code (#42)

diff --git a/assets/javascripts/discourse-assign/connectors/topic-footer-main-buttons-before-create/assign-button.js.es6 b/assets/javascripts/discourse-assign/connectors/topic-footer-main-buttons-before-create/assign-button.js.es6
index e14a552..82366b9 100644
--- a/assets/javascripts/discourse-assign/connectors/topic-footer-main-buttons-before-create/assign-button.js.es6
+++ b/assets/javascripts/discourse-assign/connectors/topic-footer-main-buttons-before-create/assign-button.js.es6
@@ -18,10 +18,10 @@ export default {
   actions: {
     unassign() {
       this.set("topic.assigned_to_user", null);
-      this.get("taskActions").unassign(this.get("topic.id"));
+      this.taskActions.unassign(this.get("topic.id"));
     },
     assign() {
-      this.get("taskActions").assign(this.topic);
+      this.taskActions.assign(this.topic);
     }
   }
 };
diff --git a/assets/javascripts/discourse-assign/controllers/assign-user.js.es6 b/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
index 13692df..4a4cb35 100644
--- a/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
+++ b/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
@@ -1,19 +1,17 @@
-//import { default as computed } from 'ember-addons/ember-computed-decorators';
 import { ajax } from "discourse/lib/ajax";
 import { popupAjaxError } from "discourse/lib/ajax-error";
 
 export default Ember.Controller.extend({
+  assignSuggestions: null,
   taskActions: Ember.inject.service(),
-  assignSuggestions: function() {
-    ajax("/assign/suggestions").then(users => {
-      this.set("assignSuggestions", users);
-    });
-  }.property(),
 
-  // @computed("username")
-  // disabled(username) {
-  //   return Ember.isEmpty(username);
-  // },
+  init() {
+    this._super(...arguments);
+
+    ajax("/assign/suggestions").then(users =>
+      this.set("assignSuggestions", users)
+    );
+  },
 
   onClose() {
     if (this.get("model.onClose") && this.get("model.username")) {
@@ -23,8 +21,10 @@ export default Ember.Controller.extend({
 
   actions: {
     assignUser(user) {
-      this.set("model.username", user.username);
-      this.set("model.allowedGroups", this.get("taskActions").allowedGroups);
+      this.setProperties({
+        "model.username": user.username,
+        "model.allowedGroups": this.taskActions.allowedGroups
+      });
       this.send("assign");
     },
 
diff --git a/assets/javascripts/discourse-assign/controllers/user-activity-assigned.js.es6 b/assets/javascripts/discourse-assign/controllers/user-activity-assigned.js.es6
index 6b65eed..7ca8c5f 100644
--- a/assets/javascripts/discourse-assign/controllers/user-activity-assigned.js.es6
+++ b/assets/javascripts/discourse-assign/controllers/user-activity-assigned.js.es6
@@ -6,12 +6,12 @@ export default UserTopicsList.extend({
 
   actions: {
     unassign(topic) {
-      this.get("taskActions")
+      this.taskActions
         .unassign(topic.get("id"))
         .then(() => this.send("changeAssigned"));
     },
     reassign(topic) {
-      const controller = this.get("taskActions").assign(topic);
+      const controller = this.taskActions.assign(topic);
       controller.set("model.onSuccess", () => this.send("changeAssigned"));
     }
   }
diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
index bb70abb..5b6aac8 100644
--- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
+++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
@@ -35,13 +35,13 @@ function modifySelectKit(api) {
         return;
       }
 
-      const topic = context.get("topic");
+      const topic = context.topic;
       const assignedUser = topic.get("assigned_to_user.username");
 
       if (assignedUser) {
         ajax("/assign/unassign", {
           type: "PUT",
-          data: { topic_id: topic.get("id") }
+          data: { topic_id: topic.id }
         })
           .then(result => {
             if (result.success && result.success === "OK") {
@@ -87,13 +87,14 @@ function initialize(api) {
           }
         }
 
-        return this.get("actableFilter");
+        return this.actableFilter;
       },
 
       didInsertElement() {
-        this._super();
+        this._super(...arguments);
+
         this.messageBus.subscribe("/staff/topic-assignment", data => {
-          let flaggedPost = this.get("flaggedPost");
+          let flaggedPost = this.flaggedPost;
           if (data.topic_id === flaggedPost.get("topic.id")) {
             flaggedPost.set(
               "topic.assigned_to_user_id",
@@ -105,7 +106,8 @@ function initialize(api) {
       },
 
       willDestroyElement() {
-        this._super();
+        this._super(...arguments);
+
         this.messageBus.unsubscribe("/staff/topic-assignment");
       }
     },
@@ -140,14 +142,14 @@ function initialize(api) {
   api.addTagsHtmlCallback(topic => {
     const assignedTo = topic.get("assigned_to_user.username");
     if (assignedTo) {
-      const assignedPath = topic.get("assignedToUserPath");
+      const assignedPath = topic.assignedToUserPath;
       let assignLabels = `<a data-auto-route='true' class='assigned-to discourse-tag simple' href='${assignedPath}'>${iconHTML(
         "user-plus"
       )}${assignedTo}</a>`;
 
       if (
         ListItemDefaults === undefined &&
-        topic.get("archetype") === "private_message"
+        topic.archetype === "private_message"
       ) {
         assignLabels += `<div>${iconHTML("envelope")} Message</div>`;
       }
@@ -157,12 +159,12 @@ function initialize(api) {
   });
 
   api.addUserMenuGlyph(widget => {
-    if (widget.currentUser && widget.currentUser.get("can_assign")) {
+    if (widget.currentUser && widget.currentUser.can_assign) {
       return {
         label: "discourse_assign.assigned",
         className: "assigned",
         icon: "user-plus",
-        href: `${widget.currentUser.get("path")}/activity/assigned`
+        href: `${widget.currentUser.path}/activity/assigned`
       };
     }
   });
@@ -185,10 +187,11 @@ function initialize(api) {
 
   api.modifyClass("controller:topic", {
     subscribe() {
-      this._super();
+      this._super(...arguments);
+
       this.messageBus.subscribe("/staff/topic-assignment", data => {
-        const topic = this.get("model");
-        const topicId = topic.get("id");
+        const topic = this.model;
+        const topicId = topic.id;
 
         if (data.topic_id === topicId) {
           topic.set(
@@ -233,7 +236,7 @@ function initialize(api) {
   api.modifyClass("controller:preferences/notifications", {
     actions: {
       save() {
-        this.get("saveAttrNames").push("custom_fields");
+        this.saveAttrNames.push("custom_fields");
         this._super(...arguments);
       }
     }
diff --git a/assets/javascripts/discourse/components/assign-actions-dropdown.js.es6 b/assets/javascripts/discourse/components/assign-actions-dropdown.js.es6
index 88ed3e4..f0c452f 100644
--- a/assets/javascripts/discourse/components/assign-actions-dropdown.js.es6
+++ b/assets/javascripts/discourse/components/assign-actions-dropdown.js.es6
@@ -28,10 +28,10 @@ export default DropdownSelectBoxComponent.extend({
     onSelect(id) {
       switch (id) {
         case "unassign":
-          this.unassign(this.get("topic"), this.get("user"));
+          this.unassign(this.topic, this.user);
           break;
         case "reassign":
-          this.reassign(this.get("topic"), this.get("user"));
+          this.reassign(this.topic, this.user);
           break;
       }
     }
diff --git a/assets/javascripts/discourse/components/assigned-topic-list-item.js.es6 b/assets/javascripts/discourse/components/assigned-topic-list-item.js.es6
index a9eaa15..9ebe092 100644
--- a/assets/javascripts/discourse/components/assigned-topic-list-item.js.es6
+++ b/assets/javascripts/discourse/components/assigned-topic-list-item.js.es6
@@ -1,11 +1,5 @@

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

GitHub sha: 75c6cecf