The best thing would be to add a new hook to Discourse core which allows you to achieve what you need in a supported way. How about something like this:
So then your plugin would do
api.registerValueTransformer(
"composer-minimum-post-length",
({ value, context: { composer } }) => {
if (
siteSettings.discourse_optional_topic_body_enabled &&
composer.topicFirstPost
) {
return 0;
}
return value; // Keep core logic
}
);
LMK if that works for your use-case and I’ll take the PR out of draft and I can get it reviewed/merged.