DEV: Don't set appEvents on app, group injections (#14929)

This commit is contained in:
Jarek Radosz 2021-11-15 00:42:49 +01:00 committed by GitHub
parent 9711caf7ea
commit 25251d4d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 33 deletions

View File

@ -24,9 +24,6 @@ export function registerObjects(container, app) {
app.register("store:main", Store); app.register("store:main", Store);
app.register("service:store", Store); app.register("service:store", Store);
// backwards compatibility: remove when plugins have updated
app.appEvents = container.lookup("service:app-events");
// TODO: This should be included properly // TODO: This should be included properly
app.register("message-bus:main", MessageBus, { instantiate: false }); app.register("message-bus:main", MessageBus, { instantiate: false });
@ -43,19 +40,10 @@ export default {
let siteSettings = container.lookup("site-settings:main"); let siteSettings = container.lookup("site-settings:main");
ALL_TARGETS.forEach((t) =>
app.inject(t, "appEvents", "service:app-events")
);
const currentUser = User.current(); const currentUser = User.current();
app.register("current-user:main", currentUser, { instantiate: false }); app.register("current-user:main", currentUser, { instantiate: false });
app.currentUser = currentUser; app.currentUser = currentUser;
ALL_TARGETS.forEach((t) => {
app.inject(t, "topicTrackingState", "topic-tracking-state:main");
app.inject(t, "pmTopicTrackingState", "pm-topic-tracking-state:main");
});
const topicTrackingState = TopicTrackingState.create({ const topicTrackingState = TopicTrackingState.create({
messageBus: MessageBus, messageBus: MessageBus,
siteSettings, siteSettings,
@ -97,24 +85,21 @@ export default {
app.register("key-value-store:main", keyValueStore, { instantiate: false }); app.register("key-value-store:main", keyValueStore, { instantiate: false });
app.register("search-service:main", SearchService); app.register("search-service:main", SearchService);
ALL_TARGETS.forEach((t) => app.inject(t, "store", "service:store")); ALL_TARGETS.forEach((t) => {
app.inject(t, "appEvents", "service:app-events");
app.inject(t, "topicTrackingState", "topic-tracking-state:main");
app.inject(t, "pmTopicTrackingState", "pm-topic-tracking-state:main");
app.inject(t, "store", "service:store");
app.inject(t, "site", "site:main");
app.inject(t, "searchService", "search-service:main");
app.inject(t, "keyValueStore", "key-value-store:main");
});
ALL_TARGETS.concat("service").forEach((t) => ALL_TARGETS.concat("service").forEach((t) => {
app.inject(t, "messageBus", "message-bus:main") app.inject(t, "session", "session:main");
); app.inject(t, "messageBus", "message-bus:main");
app.inject(t, "siteSettings", "site-settings:main");
ALL_TARGETS.concat("service").forEach((t) => });
app.inject(t, "siteSettings", "site-settings:main")
);
ALL_TARGETS.forEach((t) => app.inject(t, "site", "site:main"));
ALL_TARGETS.forEach((t) =>
app.inject(t, "searchService", "search-service:main")
);
ALL_TARGETS.forEach((t) => app.inject(t, "session", "session:main"));
app.inject("service", "session", "session:main");
if (currentUser) { if (currentUser) {
["component", "route", "controller", "service"].forEach((t) => { ["component", "route", "controller", "service"].forEach((t) => {
@ -122,10 +107,6 @@ export default {
}); });
} }
ALL_TARGETS.forEach((t) =>
app.inject(t, "keyValueStore", "key-value-store:main")
);
startTracking(topicTrackingState); startTracking(topicTrackingState);
}, },
}; };