public bool ValidateComment(CommentPart commentPart) { var text = commentPart.Author + System.Environment.NewLine + commentPart.CommentText + System.Environment.NewLine + commentPart.Email + System.Environment.NewLine + commentPart.SiteName + System.Environment.NewLine; dynamic context = new ExpandoObject(); context.Checked = false; context.IsSpam = false; context.Text = text; _spamEventHandler.CheckSpam(context); return(!context.IsSpam); }
public IEnumerable <NotifyEntry> GetNotifications() { var commentSettings = _orchardServices.WorkContext.CurrentSite.As <CommentSettingsPart>(); dynamic context = new ExpandoObject(); context.Checked = false; context.IsSpam = false; context.Text = string.Empty; _spamEventHandler.CheckSpam(context); if (commentSettings != null && commentSettings.EnableSpamProtection && !context.Checked) { yield return(new NotifyEntry { Message = T("Comments anti-spam protection requires at least one anti-spam filter to be enabled and configured."), Type = NotifyType.Warning }); } }