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

refactor: conditionally render comment for theme #4271

Merged
merged 6 commits into from Jul 24, 2023

Conversation

guqing
Copy link
Member

@guqing guqing commented Jul 21, 2023

What type of PR is this?

/kind improvement
/area core
/milestone 2.8.x
/area theme

What this PR does / why we need it:

按条件渲染评论组件以简化主题端对评论组件是否显示的条件控制

使用了评论标签的模板页面都能直接使用 ${haloCommentEnabled} 取值能得到评论组件是否可见的结果为true/false 用于在需要级联条件渲染的组件上使用,如:

<!-- 评论组件不可见时不渲染标题 -->
<p th:if="${haloCommentEnabled}">评论</p>
<halo:comment />

how to test it?
在主题端未加渲染条件时:

  1. 测试全局评论组件是否开启的设置是否有效
  2. 测试文章和自定义页面是否开启评论的设置是否有效
  3. 测试评论组件启用和停止时评论组件的渲染是否正确
  4. 测试 ${haloCommentEnabled} 结果是否正确

Which issue(s) this PR fixes:

Fixes #4137

Does this PR introduce a user-facing change?

按条件渲染评论组件以简化主题端对评论组件是否显示的条件控制

@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 21, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.8.x milestone Jul 21, 2023
@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core area/theme Issues or PRs related to the Theme Provider labels Jul 21, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from JohnNiang and ruibaby July 21, 2023 03:12
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #4271 (ca1f12a) into main (15dd782) will decrease coverage by 0.09%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main    #4271      +/-   ##
============================================
- Coverage     60.71%   60.62%   -0.09%     
- Complexity     2489     2498       +9     
============================================
  Files           369      370       +1     
  Lines         12994    13047      +53     
  Branches        933      935       +2     
============================================
+ Hits           7889     7910      +21     
- Misses         4645     4678      +33     
+ Partials        460      459       -1     
Impacted Files Coverage Δ
.../app/theme/dialect/CommentElementTagProcessor.java 100.00% <100.00%> (ø)
.../java/run/halo/app/theme/router/ModelMapUtils.java 94.73% <100.00%> (+0.61%) ⬆️

... and 9 files with indirect coverage changes

@LIlGG
Copy link
Member

LIlGG commented Jul 24, 2023

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jul 24, 2023
@guqing
Copy link
Member Author

guqing commented Jul 24, 2023

Note: 此 PR 合并后需要添加主题使用评论的文档

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jul 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit bf1be64 into halo-dev:main Jul 24, 2023
4 checks passed
@ruibaby ruibaby modified the milestones: 2.8.x, 2.8.0 Jul 24, 2023
@guqing guqing deleted the refactor/4137 branch July 24, 2023 09:39
f2c-ci-robot bot pushed a commit to halo-dev/theme-earth that referenced this pull request Sep 18, 2023
修改评论功能是否可用的判断方式。

see halo-dev/halo#4271

/kind improvement

```release-note
修改评论功能是否可用的判断方式。
```
f2c-ci-robot bot pushed a commit to halo-dev/docs that referenced this pull request Dec 1, 2023
从 Halo 2.9 开始,判断评论组件是否显示的条件不再只是单纯的判断评论插件是否安装。

see halo-dev/halo#4271

/kind documentation


```release-note
None
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core area/theme Issues or PRs related to the Theme Provider kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

优化主题端评论组件是否开启的判断逻辑
4 participants