refactor(horizon): 移除管理员通知并简化主题初始化逻辑
Discourse Theme / ci (push) Failing after 1s

- 删除了管理员使用Horizon主题时的全局通知功能
- 移除了主题ID获取和URL构建相关代码
- 简化了API初始化器中的条件判断逻辑
- 保留了实验性屏幕组件和用户颜色选择器的渲染功能
This commit is contained in:
2026-02-20 09:41:57 +08:00
parent a1bdaa8052
commit d3bb44d636
@@ -1,26 +1,8 @@
import { addGlobalNotice } from "discourse/components/global-notice";
import { apiInitializer } from "discourse/lib/api";
import getURL from "discourse/lib/get-url";
import { currentThemeId } from "discourse/lib/theme-selector";
import ExperimentalScreen from "../components/experimental-screen";
import UserColorPaletteSelector from "../components/user-color-palette-selector";
export default apiInitializer("1.8.0", (api) => {
if (api.getCurrentUser()?.admin) {
const themeId = currentThemeId();
const themeURL = getURL(`/admin/customize/themes/${themeId}`);
const horizonThemeUrl = getURL(`/admin/customize/themes/-2`);
addGlobalNotice(
`<b>Admin notice:</b> you are using the <em>Horizon (beta)</em> theme. This theme is now installed automatically in Discourse core. You should <a href="${themeURL}">uninstall this theme</a>, and reconfigure the <a href="${horizonThemeUrl}">preinstalled Horizon theme</a>.`,
"loading-slider-theme",
{
dismissable: true,
level: "warn",
dismissDuration: moment.duration("1", "hour"),
}
);
}
api.renderInOutlet("above-main-container", ExperimentalScreen);
api.renderInOutlet("sidebar-footer-actions", UserColorPaletteSelector);