mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:31:56 +08:00
DEV: Set owner of sidebar section objects (#17827)
Allows e.g. `@service` usage in their implementation
This commit is contained in:
parent
4fdb275683
commit
8b8cbe7905
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user