I have the last version in the source control and I think that the method of custom moderation is not the better. I have introduced a few changes in the RunCustomModerators method and I will want open this discussion about this.
My changes started because, in the last version (220.127.116.11) if the fisrt filter (akismet) set that the comment is spam, and the second (stopforumspam) set that is not spam, finally the comment are set with IsApproved = true.
In my opinion if one filter set that the comment are spam, the comment must have IsApproved = false.
I have changed the code in this mode:
static void RunCustomModerators(Comment comment)
DataTable dt = _customFilters.GetDataTable();
dt.DefaultView.Sort = "Priority";
foreach (DataRowView row in dt.DefaultView)
string fileterName = row.ToString();
ICustomFilter customFilter = GetCustomFilter(fileterName);
if (customFilter != null && customFilter.Initialize())
bool isSpam = customFilter.Check(comment);
comment.IsApproved = !isSpam;
comment.ModeratedBy = isSpam ? fileterName : string.Empty;
// the custom filter tells no further
// validation needed. don't call others
if (!customFilter.FallThrough) break;
I have write "comment.ModeratedBy = isSpam ? fileterName : string.Empty;" because (in my opinion) is not ok that if comment is not spam, that have the moderatedBy set with the name of last custom filter.
And "if (isSpam) return;" becuase I dont like that other custom filter can set IsApproved = true in a spam comment.
Have you other opinion?