diff --git a/app/assets/javascripts/discourse/app/models/user.js b/app/assets/javascripts/discourse/app/models/user.js index df66c2f8417..2f98ffaca34 100644 --- a/app/assets/javascripts/discourse/app/models/user.js +++ b/app/assets/javascripts/discourse/app/models/user.js @@ -170,6 +170,7 @@ function userOption(userOptionKey) { } const User = RestModel.extend({ + appEvents: service(), userTips: service(), mailing_list_mode: userOption("mailing_list_mode"), diff --git a/app/assets/javascripts/discourse/app/services/app-events.js b/app/assets/javascripts/discourse/app/services/app-events.js index 48008040cd7..8f9c4282a61 100644 --- a/app/assets/javascripts/discourse/app/services/app-events.js +++ b/app/assets/javascripts/discourse/app/services/app-events.js @@ -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) {} diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js index 5193613ae25..e8e039251e2 100644 --- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js +++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js @@ -338,8 +338,6 @@ export function acceptance(name, optionsOrCallback) { updateCurrentUser(userChanges); } - User.current().appEvents = - getOwnerWithFallback(this).lookup("service:app-events"); User.current().trackStatus(); } diff --git a/app/assets/javascripts/discourse/tests/unit/models/composer-test.js b/app/assets/javascripts/discourse/tests/unit/models/composer-test.js index 5c7d464c921..55ada1f3257 100644 --- a/app/assets/javascripts/discourse/tests/unit/models/composer-test.js +++ b/app/assets/javascripts/discourse/tests/unit/models/composer-test.js @@ -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); }