From 3d5753c42b8b045eb2bfdf6d41c9dcb12cad32f1 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Mon, 14 Nov 2022 20:36:46 +1100 Subject: [PATCH] FIX: Allow sidebar links to register didInsert actions (#19010) Previously `this.chatService.appEvents.on( "chat:user-tracking-state-changed"...)` was registered on constructor and disabled on `willDestroy`. Constructor is evaluated only once, so when the section was collapsed and collapsed then the events were not observed anymore. didInsert allows evaluating code each time a component is rendered. --- .../app/components/sidebar/section-link.hbs | 2 +- .../app/components/sidebar/section-link.js | 6 ++++++ .../app/components/sidebar/user/sections.hbs | 1 + .../tests/acceptance/sidebar-plugin-api-test.js | 14 +++++++++++++- .../discourse/initializers/chat-sidebar.js | 9 ++++++--- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs index c29385e2c0c..6be1ab4512f 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs @@ -1,5 +1,5 @@ {{#if this.shouldDisplay}} -