mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -82,7 +82,9 @@ namespace Orchard.Comments.Services {
|
|||||||
comment.Record.UserName = (CurrentUser == null ? context.Author : CurrentUser.UserName);
|
comment.Record.UserName = (CurrentUser == null ? context.Author : CurrentUser.UserName);
|
||||||
comment.Record.CommentedOn = context.CommentedOn;
|
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
|
// 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)
|
//TODO:(rpaquay) Get rid of this (comment aspect takes care of container)
|
||||||
|
@@ -44,14 +44,14 @@ namespace Orchard.Comments.Services {
|
|||||||
AkismetComment akismetComment = new AkismetComment {
|
AkismetComment akismetComment = new AkismetComment {
|
||||||
CommentAuthor = commentPart.Record.Author,
|
CommentAuthor = commentPart.Record.Author,
|
||||||
CommentAuthorEmail = commentPart.Record.Email,
|
CommentAuthorEmail = commentPart.Record.Email,
|
||||||
Blog = commentPart.Record.SiteName,
|
Blog = akismetUrl,
|
||||||
CommentAuthorUrl = commentPart.Record.SiteName,
|
CommentAuthorUrl = commentPart.Record.SiteName,
|
||||||
CommentContent = commentPart.Record.CommentText,
|
CommentContent = commentPart.Record.CommentText,
|
||||||
UserAgent = HttpContext.Current.Request.UserAgent,
|
UserAgent = HttpContext.Current.Request.UserAgent,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (akismetApi.VerifyKey()) {
|
if (akismetApi.VerifyKey()) {
|
||||||
return akismetApi.CommentCheck(akismetComment);
|
return !akismetApi.CommentCheck(akismetComment); // CommentCheck returning true == spam
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -9,16 +9,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<%: Html.EditorFor(m => m.EnableSpamProtection) %>
|
<%: 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", "*")%>
|
<%: Html.ValidationMessage("EnableSpamProtection", "*")%>
|
||||||
</div>
|
</div>
|
||||||
<div data-controllerid="CommentSettings_EnableSpamProtection">
|
<div data-controllerid="<%:Html.FieldIdFor(m => m.EnableSpamProtection) %>">
|
||||||
<label for="CommentSettings_AkismetKey"><%: T("Akismet key") %></label>
|
<label for="CommentSettings_AkismetKey"><%: T("Akismet key") %></label>
|
||||||
<%: Html.EditorFor(m => m.AkismetKey) %>
|
<%: Html.EditorFor(m => m.AkismetKey) %>
|
||||||
<%: Html.ValidationMessage("AkismetKey", "*")%>
|
<%: Html.ValidationMessage("AkismetKey", "*")%>
|
||||||
</div>
|
</div>
|
||||||
<div data-controllerid="CommentSettings_EnableSpamProtection">
|
<div data-controllerid="<%:Html.FieldIdFor(m => m.EnableSpamProtection) %>">
|
||||||
<label for="CommentSettings_AkismetUrl"><%: T("Akismet endpoint URL") %></label>
|
<label for="CommentSettings_AkismetUrl"><%: T("Blog URL")%></label>
|
||||||
<%: Html.EditorFor(m => m.AkismetUrl) %>
|
<%: Html.EditorFor(m => m.AkismetUrl) %>
|
||||||
<%: Html.ValidationMessage("AkismetUrl", "*")%>
|
<%: Html.ValidationMessage("AkismetUrl", "*")%>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user