2025-02-28 15:29:04 -05:00
|
|
|
import { apiInitializer } from "discourse/lib/api";
|
|
|
|
|
|
|
|
export default apiInitializer("1.15.0", (api) => {
|
2025-03-05 13:53:56 -08:00
|
|
|
const currentUser = api.getCurrentUser();
|
2025-02-28 15:29:04 -05:00
|
|
|
|
2025-03-05 13:53:56 -08:00
|
|
|
if (
|
|
|
|
!currentUser ||
|
|
|
|
!currentUser.admin ||
|
|
|
|
!currentUser.can_see_sentiment_reports
|
|
|
|
) {
|
|
|
|
return;
|
2025-02-28 15:29:04 -05:00
|
|
|
}
|
2025-03-05 13:53:56 -08:00
|
|
|
|
|
|
|
api.addAdminSidebarSectionLink("reports", {
|
|
|
|
name: "sentiment_overview",
|
|
|
|
route: "admin.dashboardSentiment",
|
|
|
|
label: "discourse_ai.sentiments.sidebar.overview",
|
|
|
|
icon: "chart-column",
|
|
|
|
});
|
|
|
|
api.addAdminSidebarSectionLink("reports", {
|
|
|
|
name: "sentiment_analysis",
|
|
|
|
route: "adminReports.show",
|
|
|
|
routeModels: ["sentiment_analysis"],
|
|
|
|
label: "discourse_ai.sentiments.sidebar.analysis",
|
|
|
|
icon: "chart-pie",
|
|
|
|
});
|
2025-02-28 15:29:04 -05:00
|
|
|
});
|