Fixing comment validation with out of the box spam protection enabled and changed the label of the URL setting to more accurately describe what it's for

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-28 14:12:44 -07:00
parent 6f84968bf2
commit 2c9eb65542
3 changed files with 9 additions and 7 deletions

View File

@@ -82,7 +82,9 @@ namespace Orchard.Comments.Services {
comment.Record.UserName = (CurrentUser == null ? context.Author : CurrentUser.UserName);
comment.Record.CommentedOn = context.CommentedOn;
comment.Record.Status = _commentValidator.ValidateComment(comment) ? moderateComments ? CommentStatus.Pending : CommentStatus.Approved : CommentStatus.Spam;
comment.Record.Status = _commentValidator.ValidateComment(comment)
? moderateComments ? CommentStatus.Pending : CommentStatus.Approved
: CommentStatus.Spam;
// store id of the next layer for large-grained operations, e.g. rss on blog
//TODO:(rpaquay) Get rid of this (comment aspect takes care of container)

View File

@@ -44,14 +44,14 @@ namespace Orchard.Comments.Services {
AkismetComment akismetComment = new AkismetComment {
CommentAuthor = commentPart.Record.Author,
CommentAuthorEmail = commentPart.Record.Email,
Blog = commentPart.Record.SiteName,
Blog = akismetUrl,
CommentAuthorUrl = commentPart.Record.SiteName,
CommentContent = commentPart.Record.CommentText,
UserAgent = HttpContext.Current.Request.UserAgent,
};
if (akismetApi.VerifyKey()) {
return akismetApi.CommentCheck(akismetComment);
return !akismetApi.CommentCheck(akismetComment); // CommentCheck returning true == spam
}
return false;

View File

@@ -9,16 +9,16 @@
</div>
<div>
<%: Html.EditorFor(m => m.EnableSpamProtection) %>
<label class="forcheckbox" for="CommentSettings_EnableSpamProtection"><%: T("Enable spam protection") %></label>
<label class="forcheckbox" for="<%:Html.FieldIdFor(m => m.EnableSpamProtection) %>"><%: T("Enable spam protection") %></label>
<%: Html.ValidationMessage("EnableSpamProtection", "*")%>
</div>
<div data-controllerid="CommentSettings_EnableSpamProtection">
<div data-controllerid="<%:Html.FieldIdFor(m => m.EnableSpamProtection) %>">
<label for="CommentSettings_AkismetKey"><%: T("Akismet key") %></label>
<%: Html.EditorFor(m => m.AkismetKey) %>
<%: Html.ValidationMessage("AkismetKey", "*")%>
</div>
<div data-controllerid="CommentSettings_EnableSpamProtection">
<label for="CommentSettings_AkismetUrl"><%: T("Akismet endpoint URL") %></label>
<div data-controllerid="<%:Html.FieldIdFor(m => m.EnableSpamProtection) %>">
<label for="CommentSettings_AkismetUrl"><%: T("Blog URL")%></label>
<%: Html.EditorFor(m => m.AkismetUrl) %>
<%: Html.ValidationMessage("AkismetUrl", "*")%>
</div>