DEV: Do not manually create app-events on models (#23799)
This commit is contained in:
parent
8421327845
commit
4db41ed28a
|
@ -170,6 +170,7 @@ function userOption(userOptionKey) {
|
|||
}
|
||||
|
||||
const User = RestModel.extend({
|
||||
appEvents: service(),
|
||||
userTips: service(),
|
||||
|
||||
mailing_list_mode: userOption("mailing_list_mode"),
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
import Evented from "@ember/object/evented";
|
||||
import Service from "@ember/service";
|
||||
|
||||
export default Service.extend(Evented, {
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
// A hack because we don't make `current user` properly via container in testing mode
|
||||
if (this.currentUser) {
|
||||
this.currentUser.appEvents = this;
|
||||
}
|
||||
},
|
||||
});
|
||||
export default class AppEvents extends Service.extend(Evented) {}
|
||||
|
|
|
@ -338,8 +338,6 @@ export function acceptance(name, optionsOrCallback) {
|
|||
updateCurrentUser(userChanges);
|
||||
}
|
||||
|
||||
User.current().appEvents =
|
||||
getOwnerWithFallback(this).lookup("service:app-events");
|
||||
User.current().trackStatus();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
REPLY,
|
||||
} from "discourse/models/composer";
|
||||
import { currentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||
import AppEvents from "discourse/services/app-events";
|
||||
import { module, test } from "qunit";
|
||||
import { getOwner } from "@ember/application";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
@ -16,7 +15,6 @@ import pretender, {
|
|||
|
||||
function createComposer(opts = {}) {
|
||||
opts.user ??= currentUser();
|
||||
opts.appEvents = AppEvents.create();
|
||||
const store = getOwner(this).lookup("service:store");
|
||||
return store.createRecord("composer", opts);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue