A platform for community discussion. Free, open, simple.
DEV: pass owner instead of services (#31090)
Joffrey JAFFEUX3978f45ca386
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/base-community-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/base-community-section-link.jsindex eda45e67ede..ec9d23d7412 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/base-community-section-link.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/base-community-section-link.js@@ -1,22 +1,18 @@+import { setOwner } from "@ember/owner";+import { service } from "@ember/service";+/*** Base class representing a sidebar communtiy section link interface.*/export default class BaseCommunitySectionLink {- constructor({- topicTrackingState,- currentUser,- appEvents,- router,- siteSettings,- inMoreDrawer,- overridenName,- overridenIcon,- } = {}) {- this.router = router;- this.topicTrackingState = topicTrackingState;- this.currentUser = currentUser;- this.appEvents = appEvents;- this.siteSettings = siteSettings;+ @service currentUser;+ @service appEvents;+ @service router;+ @service siteSettings;+ @service topicTrackingState;++ constructor(owner, { inMoreDrawer, overridenName, overridenIcon } = {}) {+ setOwner(this, owner);this.inMoreDrawer = inMoreDrawer;this.overridenName = overridenName;this.overridenIcon = overridenIcon;diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/section.js b/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/section.jsindex c1f4e5d4a22..b17f13cfbf2 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/section.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/section.js@@ -1,5 +1,5 @@import { tracked } from "@glimmer/tracking";-import { setOwner } from "@ember/owner";+import { getOwner, setOwner } from "@ember/owner";import { service } from "@ember/service";import AboutSectionLink from "discourse/lib/sidebar/common/community-section/about-section-link";import BadgesSectionLink from "discourse/lib/sidebar/common/community-section/badges-section-link";@@ -130,12 +130,7 @@ export default class CommunitySection {if (this.router.isDestroying) {return;}- return new sectionLinkClass({- topicTrackingState: this.topicTrackingState,- currentUser: this.currentUser,- appEvents: this.appEvents,- router: this.router,- siteSettings: this.siteSettings,+ return new sectionLinkClass(getOwner(this), {inMoreDrawer,overridenName,overridenIcon,