DEV: Rename `deprecated` to the more appropriate app-boot

This commit is contained in:
Robin Ward 2020-05-01 15:18:41 -04:00
parent cdbba81ee0
commit e57fd283db
6 changed files with 17 additions and 24 deletions

View File

@ -0,0 +1,11 @@
// discourse-skip-module
(function() {
if (window.unsupportedBrowser) {
throw "Unsupported browser detected";
}
let Discourse = requirejs("discourse/app").default;
// ensure Discourse is added as a global
window.Discourse = Discourse;
})();

View File

@ -2,7 +2,7 @@
//= require ./polyfills
//= require_tree ./select-kit
//= require ./discourse/app/app
//= require ./deprecated
//= require ./app-boot
// Stuff we need to load first
//= require ./discourse/app/lib/to-markdown
@ -97,4 +97,5 @@
//= require_tree ./discourse/app/pre-initializers
//= require_tree ./discourse/app/initializers
//= require_tree ./discourse/app/services
//= require_tree ./discourse/app/widgets

View File

@ -1,4 +0,0 @@
// ensure Discourse is added as a global
(function() {
window.Discourse = requirejs("discourse/app").default;
})();

View File

@ -1,14 +1,9 @@
/*global Mousetrap:true*/
import Application from "@ember/application";
import EmberObject, { computed } from "@ember/object";
import { computed } from "@ember/object";
import { buildResolver } from "discourse-common/resolver";
import discourseComputed, { observes } from "discourse-common/utils/decorators";
import FocusEvent from "discourse-common/mixins/focus-event";
import deprecated from "discourse-common/lib/deprecated";
if (window.unsupportedBrowser) {
throw "Unsupported browser detected";
}
const _pluginCallbacks = [];
@ -204,14 +199,4 @@ const Discourse = Application.extend(FocusEvent, {
})
}).create();
Object.defineProperty(Discourse, "Model", {
get() {
deprecated("Use an `@ember/object` instead of Discourse.Model", {
since: "2.4.0",
dropFrom: "2.5.0"
});
return EmberObject;
}
});
export default Discourse;

View File

@ -2,7 +2,6 @@ import Session from "discourse/models/session";
import KeyValueStore from "discourse/lib/key-value-store";
import Store from "discourse/models/store";
import DiscourseLocation from "discourse/lib/discourse-location";
import Discourse from "discourse/app";
import SearchService from "discourse/services/search";
import TopicTrackingState, {
startTracking
@ -33,7 +32,7 @@ export default {
const currentUser = User.current();
app.register("current-user:main", currentUser, { instantiate: false });
Discourse.currentUser = currentUser;
app.currentUser = currentUser;
const topicTrackingState = TopicTrackingState.create({
messageBus,
@ -46,7 +45,7 @@ export default {
app.inject(t, "topicTrackingState", "topic-tracking-state:main")
);
const siteSettings = Discourse.SiteSettings;
const siteSettings = app.SiteSettings;
app.register("site-settings:main", siteSettings, { instantiate: false });
ALL_TARGETS.forEach(t =>
app.inject(t, "siteSettings", "site-settings:main")

View File

@ -57,6 +57,7 @@ class DiscourseJsProcessor
activate-account
auto-redirect
embed-application
app-boot
).any? { |f| relative_path == "#{js_root}/#{f}.js" }
return true if plugin_transpile_paths.any? { |prefix| relative_path.start_with?(prefix) }