Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

系统 Properties 中默认值如果为空字符串不会返回查询结果 #1689

Closed
ruibaby opened this issue Mar 1, 2022 · 3 comments · Fixed by #1692
Closed

系统 Properties 中默认值如果为空字符串不会返回查询结果 #1689

ruibaby opened this issue Mar 1, 2022 · 3 comments · Fixed by #1692
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@ruibaby
Copy link
Member

ruibaby commented Mar 1, 2022

是什么版本出现了此问题?

1.5.0-alpha.1

使用的什么数据库?

MySQL 8.x

使用的哪种方式部署?

Fat Jar

在线站点地址

https://halo.run

发生了什么?

比如 CommentProperties 中的 GRAVATAR_DEFAULT 属性的默认值为空字符串,那么在查询接口中不会返回此字段,期望返回此字段,因为在某些情况下空字符串是有意义的。

比如初始化系统之后:

image

此设置项没有绑定属性。

image

前台评论框因为没有这个字段所以无法加载头像。

相关日志输出

No response

附加信息

No response

@ruibaby ruibaby added the kind/bug Categorizes issue or PR as related to a bug. label Mar 1, 2022
@ruibaby
Copy link
Member Author

ruibaby commented Mar 1, 2022

@JohnNiang 还记得当初这里是处于什么考虑需要过滤掉空字符串的属性吗?

https://github.com/halo-dev/halo/blob/master/src/main/java/run/halo/app/service/impl/OptionServiceImpl.java#L216

@JohnNiang
Copy link
Member

@JohnNiang 还记得当初这里是处于什么考虑需要过滤掉空字符串的属性吗?

https://github.com/halo-dev/halo/blob/master/src/main/java/run/halo/app/service/impl/OptionServiceImpl.java#L216

忘记了当初为什么要过滤掉空串的属性。不过现在有对应的需求,建议移除这样的过滤条件。

@JohnNiang JohnNiang added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Mar 1, 2022
@JohnNiang JohnNiang added this to the 1.5.x milestone Mar 1, 2022
@ruibaby ruibaby added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Mar 1, 2022
@lan-yonghui
Copy link
Contributor

@JohnNiang还记得当初这里是什么考虑需要过滤掉空字符串的吗?
https://github.com/halo-dev/halo/blob/master/src/main/java/run/halo/app/service/impl/OptionServiceImpl.java#L216

忘记了最初为什么要过滤掉空串的属性。不过有十五条需求,建议现在去掉这样的过滤条件。

这个位置我看了代码,应该是给前端请求返回值的时候,把默认配置值为0的去掉,前端其他参数不会影响,头像那个位置因为没有comment_gravatar_default这个参数了,js默认给了undefined,在gravatar源中没有undefined对应的头像!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
3 participants