From ac73c903dbf573ffc9f6dd2dba052fef008b686b Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sat, 29 Jun 2024 00:18:46 +0800 Subject: [PATCH] fix: rendering issue due to missing default values (#139) * fix: rendering issue due to missing default values Signed-off-by: Ryan Wang * Set default values for captcha Signed-off-by: Ryan Wang --- .../comment/widget/SettingConfigGetter.java | 2 +- src/main/resources/extensions/settings.yaml | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/run/halo/comment/widget/SettingConfigGetter.java b/src/main/java/run/halo/comment/widget/SettingConfigGetter.java index 1b20d3f..a0e3163 100644 --- a/src/main/java/run/halo/comment/widget/SettingConfigGetter.java +++ b/src/main/java/run/halo/comment/widget/SettingConfigGetter.java @@ -15,7 +15,7 @@ public interface SettingConfigGetter { @Accessors(chain = true) class SecurityConfig { @Getter(onMethod_ = @NonNull) - private CaptchaConfig captcha; + private CaptchaConfig captcha = CaptchaConfig.empty(); public SecurityConfig setCaptcha(CaptchaConfig captcha) { this.captcha = (captcha == null ? CaptchaConfig.empty() : captcha); diff --git a/src/main/resources/extensions/settings.yaml b/src/main/resources/extensions/settings.yaml index badf54c..b812553 100644 --- a/src/main/resources/extensions/settings.yaml +++ b/src/main/resources/extensions/settings.yaml @@ -37,6 +37,9 @@ spec: - $formkit: group name: captcha label: 验证码 + value: + enable: false + type: ALPHANUMERIC children: - $formkit: checkbox label: 匿名评论需要验证码 @@ -68,8 +71,8 @@ spec: if: "$get(enable).value === true" name: provider options: - - label: 'Gravatar' - value: 'gravatar' + - label: "Gravatar" + value: "gravatar" value: "gravatar" - $formkit: text label: 头像服务镜像地址 @@ -82,10 +85,10 @@ spec: if: "$get(enable).value === true" name: policy options: - - label: '仅匿名用户' - value: 'anonymousUser' - - label: '所有用户' - value: 'allUser' - - label: '匿名&无头像用户' - value: 'noAvatarUser' + - label: "仅匿名用户" + value: "anonymousUser" + - label: "所有用户" + value: "allUser" + - label: "匿名&无头像用户" + value: "noAvatarUser" value: "anonymousUser"