mirror of
https://ghfast.top/https://github.com/discourse/discourse-yearly-review.git
synced 2026-07-18 11:59:53 +08:00
Some checks failed
Discourse Plugin / ci (push) Has been cancelled
The end-of-year admin notice now renders on both the old and the redesigned admin dashboard, so sites still on the old dashboard keep seeing it.
30 lines
894 B
JavaScript
30 lines
894 B
JavaScript
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
import YearlyReviewAdminNotice, {
|
|
LegacyDashboardYearlyReviewAdminNotice,
|
|
} from "discourse/plugins/discourse-yearly-review/discourse/components/yearly-review-admin-notice";
|
|
|
|
export default {
|
|
name: "yearly-review-admin-notice",
|
|
initialize(container) {
|
|
withPluginApi((api) => {
|
|
const siteSettings = container.lookup("service:site-settings");
|
|
|
|
if (!siteSettings.yearly_review_enabled) {
|
|
return;
|
|
}
|
|
|
|
// Only show this in December of the current year (getMonth is 0-based).
|
|
const now = new Date();
|
|
if (now.getMonth() === 11) {
|
|
api.renderInOutlet(
|
|
"admin-dashboard-top",
|
|
LegacyDashboardYearlyReviewAdminNotice
|
|
);
|
|
api.renderInOutlet(
|
|
"admin-dashboard-after-header",
|
|
YearlyReviewAdminNotice
|
|
);
|
|
}
|
|
});
|
|
},
|
|
};
|