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

评论组件 haloCommentEnabled 属性为 null #4378

Closed
LIlGG opened this issue Aug 4, 2023 · 2 comments · Fixed by #4385
Closed

评论组件 haloCommentEnabled 属性为 null #4378

LIlGG opened this issue Aug 4, 2023 · 2 comments · Fixed by #4385
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.

Comments

@LIlGG
Copy link
Member

LIlGG commented Aug 4, 2023

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

2.8.0

使用的什么数据库?

H2

使用的哪种方式部署?

Docker Compose

在线站点地址

No response

发生了什么?

问题描述

使用 pr #4271 新增的属性 ${haloCommentEnabled} 后,页面报错。打印此值发现如下所示:

image

在评论组件前打印显示为 null,而在评论组件之后打印则为正常值(true/false)。

期望结果

在页面的任何位置都能正确获取到正常值。

相关日志输出

No response

附加信息

No response

@LIlGG
Copy link
Member Author

LIlGG commented Aug 4, 2023

/kind bug
/area core

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. area/core Issues or PRs related to the Halo Core labels Aug 4, 2023
@guqing
Copy link
Member

guqing commented Aug 4, 2023

/assign
/milstone 2.9.x

f2c-ci-robot bot pushed a commit that referenced this issue Aug 15, 2023
#### What type of PR is this?
/kind bug
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
修复评论启用状态的主题模板变量名作用域不正确的问题

评论组件标签处理器只会在处理到 `<halo:comment/>` 自定义标签时被执行,而 haloCommentEnabled 状态是评论标签之前使用的那么此时值还没有被评论标签处理器填充所以取不到正确的值,目前的做法是在模板开始解析时填充 haloCommentEnabled 变量到 context,但这样存在的问题时无法判断页面是否使用了评论自定义标签即每个页面都会有这个变量,不过目前没有更好的办法去解决这样的问题。

how to test it?
在模板页面的任意位置使用 `${haloCommentEnabled}` 都能取到正确的值。

#### Which issue(s) this PR fixes:
Fixes #4378

#### Does this PR introduce a user-facing change?
```release-note
修复评论启用状态的主题模板变量名作用域不正确的问题
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants