Skip to content

Commit

Permalink
Update Post.cshtml
Browse files Browse the repository at this point in the history
  • Loading branch information
EdiWang committed Aug 7, 2023
1 parent 8279816 commit b4cf75c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Moonglade.Web/Pages/Post.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,11 @@
</article>
@if (BlogConfig.ContentSettings.EnableComments)
{
if (BlogConfig.ContentSettings.CloseCommentAfterDays > 0)
var days = DateTime.UtcNow.Date.Subtract(Model.Post.PubDateUtc.GetValueOrDefault()).Days;

if (BlogConfig.ContentSettings.CloseCommentAfterDays > 0 && days > BlogConfig.ContentSettings.CloseCommentAfterDays)
{
var days = DateTime.UtcNow.Date.Subtract(Model.Post.PubDateUtc.GetValueOrDefault()).Days;
if (days > BlogConfig.ContentSettings.CloseCommentAfterDays)
{
<div class="alert alert-warning">@SharedLocalizer["Comment is closed."]</div>
}
<div class="alert alert-warning">@SharedLocalizer["Comment is closed."]</div>
}
else
{
Expand Down

0 comments on commit b4cf75c

Please sign in to comment.