REFACTOR: Remove `Discourse.Route` in lieu of importing

This commit is contained in:
Robin Ward 2019-11-08 15:18:13 -05:00
parent c0e105fc8c
commit 920f8c6d75
5 changed files with 18 additions and 8 deletions

View File

@ -139,6 +139,11 @@ export function buildResolver(baseName) {
},
resolveRoute(parsedName) {
if (parsedName.fullNameWithoutType === "basic") {
return requirejs("discourse/routes/discourse", null, null, true)
.default;
}
return this.customResolve(parsedName) || this._super(parsedName);
},

View File

@ -411,7 +411,7 @@ Category.reopenClass({
Object.defineProperty(Discourse, "Category", {
get() {
deprecated(
"Import the Category object instead of using Discourse.Category",
"Import the Category class instead of using Discourse.Category",
{ since: "2.4.0", dropFrom: "2.5.0" }
);
return Category;

View File

@ -259,7 +259,7 @@ export function addNavItem(item) {
Object.defineProperty(Discourse, "NavItem", {
get() {
deprecated("Import the NavItem object instead of using Discourse.NavItem", {
deprecated("Import the NavItem class instead of using Discourse.NavItem", {
since: "2.4.0",
dropFrom: "2.5.0"
});

View File

@ -2,6 +2,7 @@ import { once } from "@ember/runloop";
import Composer from "discourse/models/composer";
import { getOwner } from "discourse-common/lib/get-owner";
import Route from "@ember/routing/route";
import deprecated from "discourse-common/lib/deprecated";
const DiscourseRoute = Route.extend({
showFooter: false,
@ -107,4 +108,14 @@ const DiscourseRoute = Route.extend({
}
});
Object.defineProperty(Discourse, "Route", {
get() {
deprecated("Import the Route class instead of using Discourse.Route", {
since: "2.4.0",
dropFrom: "2.5.0"
});
return Route;
}
});
export default DiscourseRoute;

View File

@ -86,7 +86,6 @@ JS
@@whitelisted ||= Set.new(
[
"discourse/routes/discourse",
"discourse/models/site",
"discourse/models/user",
]
@ -151,11 +150,6 @@ JS
if require_name !~ /\-test$/ && require_name !~ /^discourse\/plugins\//
result = "#{class_name}#{type.classify}"
# HAX
result = "Controller" if result == "ControllerController"
result = "Route" if result == "DiscourseRoute"
result = "View" if result == "ViewView"
result = result.gsub(/Mixin$/, '')
result = result.gsub(/Model$/, '')