You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@allura.apache.org by Dave Brondsema <da...@brondsema.net> on 2019/05/17 16:01:19 UTC

[allura:tickets] #8265 Update spam filter plugins

- **status**: open --> review
- **assigned_to**: Dave Brondsema
- **Comment**:

db/8265



---

** [tickets:#8265] Update spam filter plugins**

**Status:** review
**Milestone:** unreleased
**Created:** Fri Nov 16, 2018 04:41 PM UTC by Dave Brondsema
**Last Updated:** Fri Nov 16, 2018 04:41 PM UTC
**Owner:** Dave Brondsema


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
```


---

Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.