/// <summary> /// Filters the comment. Throws an exception should the comment not be allowed. /// Otherwise returns true. This interface may be changed. /// </summary> /// <remarks> /// <p> /// The first filter examines whether comments are coming in too quickly /// from the same SourceUrl. Looks at the Blog.CommentDelayInMinutes. /// </p> /// <p> /// The second filter checks for duplicate comments. It only looks at the body /// of the comment. /// </p> /// </remarks> /// <param name="feedbackItem">Entry.</param> public void FilterAfterPersist(FeedbackItem feedbackItem) { if (!SubtextContext.User.IsAdministrator()) { if (!Blog.ModerationEnabled) { //Akismet Check... if (Blog.FeedbackSpamServiceEnabled && SpamService != null) { if (SpamService.IsSpam(feedbackItem)) { FlagAsSpam(feedbackItem); return; } } //Note, we need to explicitely set the status flag here. //Just setting Approved = true would not reset any other bits in the flag that may be set. feedbackItem.Status = FeedbackStatusFlag.Approved; } else //Moderated! { //Note, we need to explicitely set the status flag here. //Just setting NeedsModeration = true would not reset any other bits in the flag that may be set. feedbackItem.Status = FeedbackStatusFlag.NeedsModeration; } } else { //Note, we need to explicitely set the status flag here. //Just setting Approved = true would not reset any other bits in the flag that may be set. feedbackItem.Status = FeedbackStatusFlag.Approved; } SubtextContext.Repository.Update(feedbackItem); }
public SpamController(AttachService attachService , TokenSerivce tokenSerivce , NoteFileService noteFileService , UserService userService , ConfigFileService configFileService , IHttpContextAccessor accessor, SpamService spamService ) : base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor) { this.spamService = spamService; }
public MessageReceived(IServiceProvider provider) : base(provider) { _provider = provider; _commandService = _provider.GetRequiredService <CommandService>(); _chatService = _provider.GetRequiredService <ChatService>(); _resultService = _provider.GetRequiredService <ResultService>(); _spamService = _provider.GetRequiredService <SpamService>(); _rateLimitService = _provider.GetRequiredService <RateLimitService>(); _logger = _provider.GetRequiredService <LoggingService>(); _client.MessageReceived += OnMessageReceivedAsync; }