🐛 Fix: close comment system logic error when the article was expired

This commit is contained in:
Cell
2022-05-20 23:01:54 +08:00
parent 0f16e2b72c
commit 8a90e43eb8
3 changed files with 10 additions and 4 deletions
+1
View File
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat(SEO): add options to make output baidu_urls.txt file ([#138](https://github.com/Lruihao/FixIt/issues/138))
- :bug: Fix: Giscus comments invalid config `inputPosition`
- :bug: Fix: busuanzi logic error
- :bug: Fix: close comment system logic error when the article was expired
- :art: Style: add scroll bar for auto toc ([#136](https://github.com/Lruihao/FixIt/issues/136))
- :arrow_up: Chore: update some third-party libraries
- **Full Changelog:** @Lruihao [`v0.2.14...v0.2.15`](https://github.com/Lruihao/FixIt/compare/v0.2.14...v0.2.15)
@@ -13,10 +13,6 @@
{{- if gt $daysAgo $warningThreshold -}}
{{- $type = "warning" -}}
{{- $icon = "fa-exclamation-triangle" -}}
{{- /* If the article expires, close the comment or not */ -}}
{{- if $expirationReminder.closeComment -}}
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- end -}}
<div class="details admonition {{ $type }} open">
<div class="details-summary admonition-title">
+9
View File
@@ -50,6 +50,15 @@
{{- end -}}
<i class="fa-solid fa-pencil-alt fa-fw"></i>&nbsp;{{ T "wordCount" .WordCount }}&nbsp;
<i class="fa-regular fa-clock fa-fw"></i>&nbsp;{{ T "readingTime" .ReadingTime }}&nbsp;
{{- /* If the article expires, close the comment or not */ -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- if
$expirationReminder.enable
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
| and $expirationReminder.closeComment -}}
{{- .Scratch.Set "comment" (dict "enable" false) -}}
{{- end -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- /* Visitor Count */ -}}
{{- if $comment.enable -}}