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({
|
const User = RestModel.extend({
|
||||||
|
appEvents: service(),
|
||||||
userTips: service(),
|
userTips: service(),
|
||||||
|
|
||||||
mailing_list_mode: userOption("mailing_list_mode"),
|
mailing_list_mode: userOption("mailing_list_mode"),
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
import Evented from "@ember/object/evented";
|
import Evented from "@ember/object/evented";
|
||||||
import Service from "@ember/service";
|
import Service from "@ember/service";
|
||||||
|
|
||||||
export default Service.extend(Evented, {
|
export default class AppEvents extends 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;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
|
@ -338,8 +338,6 @@ export function acceptance(name, optionsOrCallback) {
|
||||||
updateCurrentUser(userChanges);
|
updateCurrentUser(userChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.current().appEvents =
|
|
||||||
getOwnerWithFallback(this).lookup("service:app-events");
|
|
||||||
User.current().trackStatus();
|
User.current().trackStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
REPLY,
|
REPLY,
|
||||||
} from "discourse/models/composer";
|
} from "discourse/models/composer";
|
||||||
import { currentUser } from "discourse/tests/helpers/qunit-helpers";
|
import { currentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import AppEvents from "discourse/services/app-events";
|
|
||||||
import { module, test } from "qunit";
|
import { module, test } from "qunit";
|
||||||
import { getOwner } from "@ember/application";
|
import { getOwner } from "@ember/application";
|
||||||
import { setupTest } from "ember-qunit";
|
import { setupTest } from "ember-qunit";
|
||||||
|
@ -16,7 +15,6 @@ import pretender, {
|
||||||
|
|
||||||
function createComposer(opts = {}) {
|
function createComposer(opts = {}) {
|
||||||
opts.user ??= currentUser();
|
opts.user ??= currentUser();
|
||||||
opts.appEvents = AppEvents.create();
|
|
||||||
const store = getOwner(this).lookup("service:store");
|
const store = getOwner(this).lookup("service:store");
|
||||||
return store.createRecord("composer", opts);
|
return store.createRecord("composer", opts);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue