Bad whitelist/blacklist behavior (allow it to be disabled)


Both the whitelist and the blacklist have some unexpected behavior. First neither can be disabled and setting either to zero causes them to either whitelist everyone or blacklist everyone. Neither of these behaviors makes sense. My suggestion is to change the code in CommentHandler.cs to disable them if they are zero. The code is below:
        // user is in the white list - approve comment
        if (BlogSettings.Instance.CommentWhiteListCount > 0 && whiteCnt >= BlogSettings.Instance.CommentWhiteListCount)
            comment.IsApproved = true;
            comment.ModeratedBy = "Rule:white list";
            return true;

        // user is in the black list - reject comment
        if (BlogSettings.Instance.CommentWhiteListCount > 0 && blackCnt >= BlogSettings.Instance.CommentBlackListCount)
            comment.IsApproved = false;
            comment.ModeratedBy = "Rule:black list";
            return true;
        return false;
Closed Mar 22, 2010 at 2:08 AM by rtur
Implemented in version


chnicola wrote Mar 20, 2010 at 7:02 PM

Ugh, copy-paste coding fail. That second if statement should have BlogSettings.Instance.CommentBlackListCount > 0. Sorry.