#8265 Update spam filter plugins

v1.11.0
closed
None
General
nobody
2019-06-17
2018-11-16
No

The mollom service doesn't exist any more, so we should remove that plugin.

The Akismet filter should be upgraded to use akismet==1.0.1 but it requires some changes. Below are my initial changes, but submit_spam and submit_ham need to be updated to send the original IP and UA, which require further changes to store them. Not sure if the current implementation is working correctly since the API says they are required.

Docs at https://akismet.readthedocs.io/en/1.0.1/overview.html

--- Allura/allura/lib/spam/akismetfilter.py
+++ Allura/allura/lib/spam/akismetfilter.py
@@ -48,9 +48,7 @@ class AkismetSpamFilter(SpamFilter):
     def __init__(self, config):
         if not AKISMET_AVAILABLE:
             raise ImportError('akismet not available')
-        self.service = akismet.Akismet(
-            config.get('spam.key'), config.get('base_url'))
-        self.service.verify_key()
+        self.service = akismet.Akismet(config['spam.key'], config['base_url'])

     def get_data(self, text, artifact=None, user=None, content_type='comment', request=None, **kw):
         kw['comment_content'] = text
@@ -76,14 +74,12 @@ def get_data(self, text, artifact=None, user=None, content_type='comment', reque
         return kw

     def check(self, text, artifact=None, user=None, content_type='comment', **kw):
-        res = self.service.comment_check(text,
-                                         data=self.get_data(text=text,
-                                                            artifact=artifact,
-                                                            user=user,
-                                                            content_type=content_type,
-                                                            request=request,
-                                                            ),
-                                         build_data=False)
+        res = self.service.comment_check(**self.get_data(text=text,
+                                                         artifact=artifact,
+                                                         user=user,
+                                                         content_type=content_type,
+                                                         request=request,
+                                                         ))
         self.record_result(res, artifact, user)
         return res

Discussion

  • Dave Brondsema

    Dave Brondsema - 2019-05-17
    • status: open --> review
    • assigned_to: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2019-05-17

    db/8265

     
  • Kenton Taylor - 2019-05-28
    • status: review --> closed
     
  • Dave Brondsema

    Dave Brondsema - 2019-06-17
    • Milestone: unreleased --> v1.11.0
     

Log in to post a comment.