Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Fixed "Bad username" filter bug and re-enabled it. #2

Merged
merged 1 commit into from
Sep 28, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions Phamhilator/PostChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public static PostAnalysis CheckPost(Post post)
return info;
}

// TODO: Returning false positives, even when name dose not contain any blacklisted name terms.

//IsBadUsername(post, ref info);
IsBadUsername(post, ref info);

return info;
}
Expand Down Expand Up @@ -202,7 +200,7 @@ private static bool IsBadUsername(Post post, ref PostAnalysis info)
{
foreach (var whiteTerm in GlobalInfo.WhiteName.Terms[post.Site])
{
if (whiteTerm.Key.IsMatch(post.Title))
if (whiteTerm.Key.IsMatch(post.AuthorName))
{
info.Accuracy -= whiteTerm.Value;
info.WhiteTermsFound.Add(whiteTerm.Key, whiteTerm.Value);
Expand All @@ -215,7 +213,7 @@ private static bool IsBadUsername(Post post, ref PostAnalysis info)

foreach (var blackTerm in GlobalInfo.BlackName.Terms)
{
if (blackTerm.Key.IsMatch(post.Title))
if (blackTerm.Key.IsMatch(post.AuthorName))
{
info.Accuracy += blackTerm.Value;
info.BlackTermsFound.Add(blackTerm.Key, blackTerm.Value);
Expand Down