FIX: currentUser was missing `appEvents` (#11758)
This commit is contained in:
parent
e968af6dd4
commit
cdaa506397
|
@ -117,8 +117,10 @@ export default {
|
|||
},
|
||||
|
||||
teardown() {
|
||||
this.keyTrapper.reset();
|
||||
this.keyTrapper = null;
|
||||
if (this.keyTrapper) {
|
||||
this.keyTrapper.reset();
|
||||
this.keyTrapper = null;
|
||||
}
|
||||
this.container = null;
|
||||
},
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ export default {
|
|||
|
||||
let siteSettings = container.lookup("site-settings:main");
|
||||
|
||||
ALL_TARGETS.forEach((t) =>
|
||||
app.inject(t, "appEvents", "service:app-events")
|
||||
);
|
||||
|
||||
const currentUser = User.current();
|
||||
app.register("current-user:main", currentUser, { instantiate: false });
|
||||
app.currentUser = currentUser;
|
||||
|
@ -82,10 +86,6 @@ export default {
|
|||
|
||||
ALL_TARGETS.forEach((t) => app.inject(t, "store", "service:store"));
|
||||
|
||||
ALL_TARGETS.forEach((t) =>
|
||||
app.inject(t, "appEvents", "service:app-events")
|
||||
);
|
||||
|
||||
ALL_TARGETS.concat("service").forEach((t) =>
|
||||
app.inject(t, "messageBus", "message-bus:main")
|
||||
);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
|
||||
acceptance("current-user", function (needs) {
|
||||
needs.user();
|
||||
|
||||
test("currentUser has appEvents", function (assert) {
|
||||
let currentUser = this.container.lookup("current-user:main");
|
||||
assert.ok(currentUser.appEvents);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue