Skip to content

Commit

Permalink
Merge pull request #534 from poppastring/comment-fix
Browse files Browse the repository at this point in the history
Comment fix
  • Loading branch information
poppastring authored Mar 11, 2021
2 parents 06b9a13 + d55dee6 commit 2784ec7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 32 deletions.
4 changes: 2 additions & 2 deletions source/DasBlog.Web.UI/Controllers/BlogPostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ public IActionResult AddComment(AddCommentViewModel addcomment)

// Optional in case of Captcha. Commenting the settings in the config file
// Will disable this check. People will typically disable this when using captcha.
if (!String.IsNullOrEmpty(dasBlogSettings.SiteConfiguration.CheesySpamQ) &&
!String.IsNullOrEmpty(dasBlogSettings.SiteConfiguration.CheesySpamA) &&
if (!string.IsNullOrEmpty(dasBlogSettings.SiteConfiguration.CheesySpamQ) &&
!string.IsNullOrEmpty(dasBlogSettings.SiteConfiguration.CheesySpamA) &&
dasBlogSettings.SiteConfiguration.CheesySpamQ.Trim().Length > 0 &&
dasBlogSettings.SiteConfiguration.CheesySpamA.Trim().Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class AddCommentViewModel
[Required]
[Display(Name = "Name")]
[StringLength(60, MinimumLength = 1)]
[RegularExpression("^[\\w'\\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\\]]{2,}$", ErrorMessage = "Invalid name format")]
public string Name { get; set; }

[Required]
Expand Down
5 changes: 5 additions & 0 deletions source/DasBlog.Web.UI/Settings/DasBlogSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public DateTime GetContentLookAhead()

public string FilterHtml(string input)
{
if (string.IsNullOrWhiteSpace(input))
{
return string.Empty;
}

if (SiteConfiguration.ValidCommentTags == null || SiteConfiguration.ValidCommentTags[0].Tag.Count(s => s.Allowed == true) == 0)
{
return WebUtility.HtmlEncode(input);
Expand Down
12 changes: 6 additions & 6 deletions source/DasBlog.Web.UI/Views/Admin/ManageComments.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
@foreach (var comment in Model)
{
<tr>
<td><a href="@dasBlogSettings.GetPermaLinkUrl(comment.BlogPostId)">@comment.Title</a></td>
<td><a href="mailto:@[email protected]&[email protected]">@comment.Name</a></td>
<td>@comment.SpamState</td>
<td>@comment.Text</td>
<td><comment-approval-link comment="@comment" admin="true" /></td>
<td><comment-delete-link comment="@comment" admin="true" /></td>
<td width="30%"><a href="@dasBlogSettings.GetPermaLinkUrl(comment.BlogPostId)">@comment.Title</a></td>
<td width="10%"><a href="mailto:@[email protected]">@comment.Name</a></td>
<td width="10%">@comment.SpamState</td>
<td width="30%">@comment.Text</td>
<td width="10%"><comment-approval-link comment="@comment" admin="true" /></td>
<td width="10%"><comment-delete-link comment="@comment" admin="true" /></td>
</tr>
}
</tbody>
Expand Down
24 changes: 0 additions & 24 deletions source/DasBlog.Web.UI/content/2020-02-28.dayentry.xml

This file was deleted.

0 comments on commit 2784ec7

Please sign in to comment.