Mollom has a Blacklist API which isn't documented (yet) in the official API documentation. Mollom automatically maintains whitelists and blacklists based on statistical analysis, reputation models and feedback sent by users. However, as an end-user you are able to provide custom URL and Text blacklists using the Mollom Blacklist API. Mollom will store the blacklisted words and URLs on the server-side, and use them in mollom.checkContent() calls.

Attached patch adds some basic tests for the Mollom Blacklist API. Once this patch is committed, we can add a UI to the Mollom configuration pages to enable site owners to maintain those blacklists through a UI.

Comments

sun’s picture

Do those tests pass already?

+++ tests/mollom.test	22 Dec 2009 11:43:36 -0000
@@ -680,6 +680,106 @@
+  function testUrlBlackListAPI() {
+	// Blacklist an URL:
+    mollom('mollom.addBlacklistURL', array(
+	  'url' => 'http://unicorn.com'));
...
+    $result = mollom('mollom.checkContent', array(
+      'post_body' => "When the URL is expanded in the front, the post should get blocked: http://www.unicorn.com"));
...
+  function testTextBlackListAPI() {
+	// Blacklist a word:
+    mollom('mollom.addBlacklistText', array(
+	  'text' => 'unicorn',
+	  'match' => 'contains',
+	  'reason' => 'spam',
+	  'language' => 'en'));
...
+	// To update the work (i.e. to change the 'match' property), we simply 
+	// overwrite it.
+    mollom('mollom.addBlacklistText', array(
+	  'text' => 'unicorn',
+	  'match' => 'exact',
+	  'reason' => 'spam',
+	  'language' => 'en'));
...
+	

Strange indentation, wrapping, multi-line array syntax, and also trailing white-space here.

I'm on crack. Are you, too?

dries’s picture

StatusFileSize
new4.89 KB

I'm trying TextMate for the occasion instead of my trusted old vim. Looks like I don't have things configured properly so I took a quick pass over it with vim.

These new tests are passing for me.

dries’s picture

Status: Needs review » Fixed

I committed this to the CVS HEAD branch.

sun’s picture

Status: Fixed » Reviewed & tested by the community
StatusFileSize
new5.51 KB

Hm. Call me nitpicky or whatever, but it is my belief that ensuring and enforcing coding standards is the underlying fact that drives innovation and the Drupal community's success.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 3c95f6a on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #665712 by sun: fixed coding style issues.
    
    
  • Commit d415951 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #665712 by Dries: implemented tests for the Mollom Blacklist API...

  • Commit 3c95f6a on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #665712 by sun: fixed coding style issues.
    
    
  • Commit d415951 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #665712 by Dries: implemented tests for the Mollom Blacklist API...