From 8b8cbe79051d1993fc5f218f9aa782bdc023dd49 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 8 Aug 2022 16:35:14 +0200 Subject: [PATCH] DEV: Set owner of sidebar section objects (#17827) Allows e.g. `@service` usage in their implementation --- .../javascripts/discourse/app/components/sidebar/sections.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/sections.js b/app/assets/javascripts/discourse/app/components/sidebar/sections.js index c260f738651..748d408d8f4 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/sections.js +++ b/app/assets/javascripts/discourse/app/components/sidebar/sections.js @@ -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; }); } }