🐛 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
+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 -}}