DEV: Set owner of sidebar section objects (#17827)

Allows e.g. `@service` usage in their implementation
This commit is contained in:
Jarek Radosz 2022-08-08 16:35:14 +02:00 committed by GitHub
parent 4fdb275683
commit 8b8cbe7905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import GlimmerComponent from "discourse/components/glimmer";
import { customSections as sidebarCustomSections } from "discourse/lib/sidebar/custom-sections";
import { getOwner, setOwner } from "@ember/application";
export default class SidebarSections extends GlimmerComponent {
customSections;
@ -11,7 +12,9 @@ export default class SidebarSections extends GlimmerComponent {
get _customSections() {
return sidebarCustomSections.map((customSection) => {
return new customSection({ sidebar: this });
const section = new customSection({ sidebar: this });
setOwner(section, getOwner(this));
return section;
});
}
}