REFACTOR: Remove `Discourse.Category` constants

REFACTOR: Remove Discourse.Category constants

diff --git a/app/assets/javascripts/admin/components/embeddable-host.js.es6 b/app/assets/javascripts/admin/components/embeddable-host.js.es6
index 054acc744c..1d853b8986 100644
--- a/app/assets/javascripts/admin/components/embeddable-host.js.es6
+++ b/app/assets/javascripts/admin/components/embeddable-host.js.es6
@@ -6,6 +6,7 @@ import Component from "@ember/component";
 import { bufferedProperty } from "discourse/mixins/buffered-content";
 import { on, observes } from "discourse-common/utils/decorators";
 import { popupAjaxError } from "discourse/lib/ajax-error";
+import Category from "discourse/models/category";
 
 export default Component.extend(bufferedProperty("host"), {
   editToggled: false,
@@ -50,7 +51,7 @@ export default Component.extend(bufferedProperty("host"), {
       host
         .save(props)
         .then(() => {
-          host.set("category", Discourse.Category.findById(this.categoryId));
+          host.set("category", Category.findById(this.categoryId));
           this.set("editToggled", false);
         })
         .catch(popupAjaxError);
diff --git a/app/assets/javascripts/admin/components/site-settings/category-list.js.es6 b/app/assets/javascripts/admin/components/site-settings/category-list.js.es6
index 5d4b68b19b..ff83e13e52 100644
--- a/app/assets/javascripts/admin/components/site-settings/category-list.js.es6
+++ b/app/assets/javascripts/admin/components/site-settings/category-list.js.es6
@@ -1,11 +1,12 @@
 import discourseComputed from "discourse-common/utils/decorators";
 import Component from "@ember/component";
+import Category from "discourse/models/category";
 
 export default Component.extend({
   @discourseComputed("value")
   selectedCategories: {
     get(value) {
-      return Discourse.Category.findByIds(value.split("|"));
+      return Category.findByIds(value.split("|"));
     },
     set(value) {
       this.set("value", value.mapBy("id").join("|"));
diff --git a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6
index 42e85897ea..f0a3d817c1 100644
--- a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6
+++ b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6
@@ -5,6 +5,7 @@ import { observes } from "discourse-common/utils/decorators";
 import { escapeExpression } from "discourse/lib/utilities";
 import Group from "discourse/models/group";
 import Badge from "discourse/models/badge";
+import Category from "discourse/models/category";
 
 const REGEXP_BLOCKS = /(([^" \t\n\x0B\f\r]+)?(("[^"]+")?))/g;
 
@@ -224,7 +225,7 @@ export default Component.extend({
         .replace(REGEXP_CATEGORY_PREFIX, "")
         .split(":");
       if (subcategories.length > 1) {
-        const userInput = Discourse.Category.findBySlug(
+        const userInput = Category.findBySlug(
           subcategories[1],
           subcategories[0]
         );
@@ -234,14 +235,14 @@ export default Component.extend({
         )
           this.set("searchedTerms.category", userInput);
       } else if (isNaN(subcategories)) {
-        const userInput = Discourse.Category.findSingleBySlug(subcategories[0]);
+        const userInput = Category.findSingleBySlug(subcategories[0]);
         if (
           (!existingInput && userInput) ||
           (existingInput && userInput && existingInput.id !== userInput.id)
         )
           this.set("searchedTerms.category", userInput);
       } else {
-        const userInput = Discourse.Category.findById(subcategories[0]);
+        const userInput = Category.findById(subcategories[0]);
         if (
           (!existingInput && userInput) ||
           (existingInput && userInput && existingInput.id !== userInput.id)
diff --git a/app/assets/javascripts/discourse/components/tag-list.js.es6 b/app/assets/javascripts/discourse/components/tag-list.js.es6
index ee6de7fa3a..a6472a1c6e 100644
--- a/app/assets/javascripts/discourse/components/tag-list.js.es6
+++ b/app/assets/javascripts/discourse/components/tag-list.js.es6
@@ -1,6 +1,7 @@
 import discourseComputed from "discourse-common/utils/decorators";
 import { sort } from "@ember/object/computed";
 import Component from "@ember/component";
+import Category from "discourse/models/category";
 
 export default Component.extend({
   classNameBindings: [":tag-list", "categoryClass", "tagGroupNameClass"],
@@ -15,7 +16,7 @@ export default Component.extend({
 
   @discourseComputed("categoryId")
   category(categoryId) {
-    return categoryId && Discourse.Category.findById(categoryId);
+    return categoryId && Category.findById(categoryId);
   },
 
   @discourseComputed("category.fullSlug")
diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6
index 6345bb8aa2..c797ed7565 100644
--- a/app/assets/javascripts/discourse/controllers/discovery.js.es6
+++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6
@@ -2,6 +2,7 @@ import { alias, not } from "@ember/object/computed";
 import { inject } from "@ember/controller";
 import Controller from "@ember/controller";
 import DiscourseURL from "discourse/lib/url";
+import Category from "discourse/models/category";
 
 export default Controller.extend({
   discoveryTopics: inject("discovery/topics"),
@@ -25,7 +26,7 @@ export default Controller.extend({
     if (category) {
       url =
         "/c/" +
-        Discourse.Category.slugFor(category) +
+        Category.slugFor(category) +
         (this.noSubcategories ? "/none" : "") +
         "/l";
     }
diff --git a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 b/app/assets/javascripts/discourse/controllers/edit-category.js.es6
index 21b1e5c5ac..a529f05e87 100644
--- a/app/assets/javascripts/discourse/controllers/edit-category.js.es6
+++ b/app/assets/javascripts/discourse/controllers/edit-category.js.es6
@@ -8,6 +8,7 @@ import {
   on,
   observes
 } from "discourse-common/utils/decorators";
+import Category from "discourse/models/category";
 
 export default Controller.extend(ModalFunctionality, {
   selectedTab: null,
@@ -106,7 +107,7 @@ export default Controller.extend(ModalFunctionality, {
             slug: result.category.slug,
             id: result.category.id
           });
-          DiscourseURL.redirectTo("/c/" + Discourse.Category.slugFor(model));
+          DiscourseURL.redirectTo("/c/" + Category.slugFor(model));
         })
         .catch(error => {
           this.flash(extractError(error), "error");
diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6
index a457060722..99a5b2194d 100644
--- a/app/assets/javascripts/discourse/controllers/history.js.es6
+++ b/app/assets/javascripts/discourse/controllers/history.js.es6
@@ -15,6 +15,7 @@ import { on, observes } from "discourse-common/utils/decorators";
 import { sanitizeAsync } from "discourse/lib/text";
 import { iconHTML } from "discourse-common/lib/icon-library";
 import Post from "discourse/models/post";
+import Category from "discourse/models/category";
 
 function customTagArray(fieldName) {
   return computed(fieldName, function() {
@@ -95,10 +96,7 @@ export default Controller.extend(ModalFunctionality, {
           post.set("topic.fancy_title", result.topic.fancy_title);
         }
         if (result.category_id) {
-          post.set(
-            "topic.category",
-            Discourse.Category.findById(result.category_id)
-          );
+          post.set("topic.category", Category.findById(result.category_id));
         }
         this.send("closeModal");
       })
@@ -226,7 +224,7 @@ export default Controller.extend(ModalFunctionality, {
   @discourseComputed("model.category_id_changes")
   previousCategory(changes) {
     if (changes) {
-      var category = Discourse.Category.findById(changes["previous"]);
+      var category = Category.findById(changes["previous"]);

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

GitHub sha: 7ac2a555