mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Rename deprecated
to the more appropriate app-boot
This commit is contained in:
parent
cdbba81ee0
commit
e57fd283db
11
app/assets/javascripts/app-boot.js
Normal file
11
app/assets/javascripts/app-boot.js
Normal 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;
|
||||
})();
|
|
@ -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
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
// ensure Discourse is added as a global
|
||||
(function() {
|
||||
window.Discourse = requirejs("discourse/app").default;
|
||||
})();
|
|
@ -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;
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) }
|
||||
|
|
Loading…
Reference in New Issue
Block a user