Opened 9 years ago
Closed 7 years ago
#6594 closed enhancement (fixed)
Add "X-akismet-pro-tip" support to Activity Akismet integration
Reported by: | DJPaul | Owned by: | djpaul |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | has-patch good-first-bug |
Cc: |
Description
See the "spam response example" on http://akismet.com/development/api/#comment-check and http://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/
We already have the headers in an array, it should be fairly easy to add a check for this header in.
Attachments (1)
Change History (14)
#2
@
8 years ago
It's been too long to remember the conditions for this to happen (I'd have to look at the implementation in the Akismet plugin again), but something like that, yes.
#3
@
8 years ago
Related: #bbPress2853
p.s. There's an initial patch there that may, or may not help for this ticket
#7
@
7 years ago
- Owner set to djpaul
- Resolution set to fixed
- Status changed from new to closed
In 11890:
#8
@
7 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Trunk was causing a never-ending AJAX request when posting any activity update.
I used git bisect
to determine where this bug originated and git bisect
returned this changeset (r11890).
To duplicate:
- Run BP trunk.
- Activate the Akismet plugin and configure Akismet with a valid Akismet API key
- Navigate to the Activity Directory and attempt to post an activity update.
- The activity update is never posted because the AJAX request never ends.
- If you refresh the page, you'll see that the activity update was posted several times, depending on the amount of time you left the AJAX request running.
I don't have time at the moment to look into this, but can we revert r11890 or get more testers to verify?
#10
@
7 years ago
Can I have the log or the backtrack please? Ta.
What specifically do you need a log of?
If it is for $response = Akismet::http_post( $query_string, $path );
Here's what I get:
Array ( [0] => Requests_Utility_CaseInsensitiveDictionary Object ( [data:protected] => Array ( [server] => nginx [date] => Sun, 25 Mar 2018 01:43:19 GMT [content-type] => text/plain; charset=utf-8 [content-length] => 5 [x-akismet-guid] => XXX ) ) [1] => false )
After some more debugging, I've found that this line is the cause of the hang-up:
$activity_data['bp_as_result_headers'] = $response[0];
Once I comment this line out, the activity update is able to post normally.
Since $response[0]
is an instance of the Requests_Utility_CaseInsensitiveDictionary
class, I tried using the getAll() method to fetch the headers:
$activity_data['bp_as_result_headers'] = $response[0]->getAll();
But, this also causes the infinite loop. I'm not too familiar with the Akismet API, so I'm not sure how to set the headers properly.
Hope that helps somewhat. Let me know if you need anything else from me.
#11
@
7 years ago
- Keywords has-patch added; needs-patch removed
Decided to look at how the Akismet plugin sets its headers. They only set the 'akismet_pro_tip'
header and that's it:
https://plugins.trac.wordpress.org/browser/akismet/tags/4.0.3/class.akismet.php#L187
So that's what 01.patch
does. Did some tests and this fixes the infinite loop problem.
Related file:
class-bp-akismet.php
@DJPaul
So is this task basically about taking into account "Strictness" setting in Akismet admin area and automatically removing comments with a
X-akismet-pro-tip: discard
response header from Akismet, when "Silently discard the worst and most pervasive spam so I never see it." is selected?