diff --git a/assets/javascripts/discourse/connectors/admin-user-controls-after/add-user-notes-button.gjs b/assets/javascripts/discourse/connectors/admin-user-controls-after/add-user-notes-button.gjs
index 5e0d51d..45be413 100644
--- a/assets/javascripts/discourse/connectors/admin-user-controls-after/add-user-notes-button.gjs
+++ b/assets/javascripts/discourse/connectors/admin-user-controls-after/add-user-notes-button.gjs
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import { action } from "@ember/object";
-import { getOwner } from "@ember/owner";
+import { service } from "@ember/service";
import { classNames, tagName } from "@ember-decorators/component";
import ShowUserNotes from "../../components/show-user-notes";
import { showUserNotes } from "../../lib/user-notes";
@@ -13,6 +13,8 @@ export default class AddUserNotesButton extends Component {
return siteSettings.user_notes_enabled && currentUser && currentUser.staff;
}
+ @service store;
+
init() {
super.init(...arguments);
const { model } = this;
@@ -24,14 +26,15 @@ export default class AddUserNotesButton extends Component {
@action
showUserNotes() {
- const store = getOwner(this).lookup("service:store");
- const user = this.get("args.model");
- showUserNotes(store, user.id, (count) => this.set("userNotesCount", count));
+ const user = this.model;
+ showUserNotes(this.store, user.id, (count) =>
+ this.set("userNotesCount", count)
+ );
}
diff --git a/assets/javascripts/discourse/connectors/after-reviewable-post-user/show-user-notes-on-flags.gjs b/assets/javascripts/discourse/connectors/after-reviewable-post-user/show-user-notes-on-flags.gjs
index a270034..c2bed1c 100644
--- a/assets/javascripts/discourse/connectors/after-reviewable-post-user/show-user-notes-on-flags.gjs
+++ b/assets/javascripts/discourse/connectors/after-reviewable-post-user/show-user-notes-on-flags.gjs
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import EmberObject, { action } from "@ember/object";
-import { getOwner } from "@ember/owner";
+import { service } from "@ember/service";
import { classNames, tagName } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
@@ -15,6 +15,8 @@ export default class ShowUserNotesOnFlags extends Component {
return context.siteSettings.user_notes_enabled && args.user;
}
+ @service store;
+
init() {
super.init(...arguments);
const model = EmberObject.create(this.user);
@@ -31,16 +33,17 @@ export default class ShowUserNotesOnFlags extends Component {
@action
showUserNotes() {
- const store = getOwner(this).lookup("service:store");
- const user = this.get("args.user");
- showUserNotes(store, user.id, (count) => this.set("userNotesCount", count));
+ const user = this.user;
+ showUserNotes(this.store, user.id, (count) =>
+ this.set("userNotesCount", count)
+ );
}
{{#if this.userNotesCount}}
{{#if this.emojiEnabled}}
diff --git a/assets/javascripts/discourse/connectors/user-profile-controls/show-notes-on-profile.gjs b/assets/javascripts/discourse/connectors/user-profile-controls/show-notes-on-profile.gjs
index 47aaef0..64f0330 100644
--- a/assets/javascripts/discourse/connectors/user-profile-controls/show-notes-on-profile.gjs
+++ b/assets/javascripts/discourse/connectors/user-profile-controls/show-notes-on-profile.gjs
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import { action } from "@ember/object";
-import { getOwner } from "@ember/owner";
+import { service } from "@ember/service";
import { classNames, tagName } from "@ember-decorators/component";
import ShowUserNotes from "../../components/show-user-notes";
import { showUserNotes } from "../../lib/user-notes";
@@ -13,6 +13,8 @@ export default class ShowNotesOnProfile extends Component {
return siteSettings.user_notes_enabled && currentUser && currentUser.staff;
}
+ @service store;
+
init() {
super.init(...arguments);
const { model } = this;
@@ -24,14 +26,15 @@ export default class ShowNotesOnProfile extends Component {
@action
showUserNotes() {
- const store = getOwner(this).lookup("service:store");
- const user = this.get("args.model");
- showUserNotes(store, user.id, (count) => this.set("userNotesCount", count));
+ const user = this.model;
+ showUserNotes(this.store, user.id, (count) =>
+ this.set("userNotesCount", count)
+ );
}