DEV: include excerpt-expanded class when gists are enabled (#1267)

This commit is contained in:
Kris 2025-04-16 15:26:04 -04:00 committed by GitHub
parent b5d42f373b
commit 3440395623
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer("1.15.0", (api) => {
const gistService = api.container.lookup("service:gists");
api.registerValueTransformer(
"topic-list-item-class",
({ value, context }) => {
const shouldShow =
gistService.preference === "table-ai" && gistService.shouldShow;
if (context.topic.get("ai_topic_gist") && shouldShow) {
value.push("excerpt-expanded");
}
return value;
}
);
});