C# Class Subtext.Framework.CommentFilter

Class used to filter incoming comments. This will get replaced with a plugin once the plugin architecture is complete, but the logic will probably get ported.
Inheritance: ICommentFilter
Exibir arquivo Open project: ayende/Subtext Class Usage Examples

Public Methods

Method Description
ClearCommentCache ( ) : void

Clears the comment cache.

CommentFilter ( Cache cache ) : System

Initializes a new instance of the CommentFilter class.

FilterAfterPersist ( FeedbackItem feedbackItem ) : void

Filters the comment. Throws an exception should the comment not be allowed. Otherwise returns true. This interface may be changed.

The first filter examines whether comments are coming in too quickly from the same SourceUrl. Looks at the BlogInfo.CommentDelayInMinutes.

The second filter checks for duplicate comments. It only looks at the body of the comment.

FilterBeforePersist ( FeedbackItem feedback ) : void

Validates the feedback before it has been persisted.

Private Methods

Method Description
FlagAsSpam ( FeedbackItem feedbackItem ) : void
IsDuplicateComment ( FeedbackItem feedbackItem ) : bool
SourceFrequencyIsValid ( FeedbackItem feedbackItem ) : bool

Method Details

ClearCommentCache() public method

Clears the comment cache.
public ClearCommentCache ( ) : void
return void

CommentFilter() public method

Initializes a new instance of the CommentFilter class.
public CommentFilter ( Cache cache ) : System
cache Cache
return System

FilterAfterPersist() public method

Filters the comment. Throws an exception should the comment not be allowed. Otherwise returns true. This interface may be changed.

The first filter examines whether comments are coming in too quickly from the same SourceUrl. Looks at the BlogInfo.CommentDelayInMinutes.

The second filter checks for duplicate comments. It only looks at the body of the comment.

public FilterAfterPersist ( FeedbackItem feedbackItem ) : void
feedbackItem Subtext.Framework.Components.FeedbackItem Entry.
return void

FilterBeforePersist() public method

Validates the feedback before it has been persisted.
Thrown if too many comments are received from the same source in a short period. Thrown if the blog does not allow duplicate comments and too many are received in a short period of time.
public FilterBeforePersist ( FeedbackItem feedback ) : void
feedback Subtext.Framework.Components.FeedbackItem
return void