DEV: Do not manually create app-events on models (#23799)

This commit is contained in:
Jarek Radosz 2023-10-05 21:22:16 +02:00 committed by GitHub
parent 8421327845
commit 4db41ed28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 14 deletions

View File

@ -170,6 +170,7 @@ function userOption(userOptionKey) {
}
const User = RestModel.extend({
appEvents: service(),
userTips: service(),
mailing_list_mode: userOption("mailing_list_mode"),

View File

@ -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) {}

View File

@ -338,8 +338,6 @@ export function acceptance(name, optionsOrCallback) {
updateCurrentUser(userChanges);
}
User.current().appEvents =
getOwnerWithFallback(this).lookup("service:app-events");
User.current().trackStatus();
}

View File

@ -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);
}