This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ export default class DoughnutChart extends Component {
6060 }
6161
6262 <template >
63- <Chart @ chartConfig ={{this .config }} class =" admin-report-doughnut" />
63+ {{#if this . config }}
64+ <Chart @ chartConfig ={{this .config }} class =" admin-report-doughnut" />
65+ {{/if }}
6466 </template >
6567}
Original file line number Diff line number Diff line change 11import { withPluginApi } from "discourse/lib/plugin-api" ;
22import AdminReportEmotion from "discourse/plugins/discourse-ai/discourse/components/admin-report-emotion" ;
3- import AdminReportSentimentAnalysis from "../discourse/components/admin-report-sentiment-analysis" ;
43
54export default {
65 name : "discourse-ai-admin-reports" ,
@@ -11,7 +10,13 @@ export default {
1110 return ;
1211 }
1312
14- withPluginApi ( "2.0.1" , ( api ) => {
13+ // We need to import dynamically with CommonJS require because
14+ // using ESM import would cause the component to be imported globally
15+ // and cause errors for non-admin users since the component is only available to admins
16+ const AdminReportSentimentAnalysis =
17+ require ( "discourse/plugins/discourse-ai/discourse/components/admin-report-sentiment-analysis" ) . default ;
18+
19+ withPluginApi ( ( api ) => {
1520 api . registerReportModeComponent ( "emotion" , AdminReportEmotion ) ;
1621 api . registerReportModeComponent (
1722 "sentiment_analysis" ,
You can’t perform that action at this time.
0 commit comments