joshfrench / rakismet

Easy Akismet and TypePad AntiSpam integration for Rails
MIT License
355 stars 46 forks source link

user_role is not working #38

Closed takestar15 closed 8 years ago

takestar15 commented 9 years ago

I tried to send user_role parameter to Askimet, but it actually sends 'comment_user_role'.

rakismet_attrs :author => proc { user.full_name }, :author_email => proc { user.email }, :content => :body, :user_ip => proc { user.current_sign_in_ip }, :user_role => 'administrator', :comment_type => 'blog-post'

Even I set user_role as 'administrator', it returns true. This is because of https://github.com/joshfrench/rakismet/blob/master/lib/rakismet/model.rb#L17, which converts 'user_role' to 'comment_user_role'.

joshfrench commented 9 years ago

user_role doesn't appear to be something that Akismet cares about: http://akismet.com/development/api/#comment-check

takestar15 commented 9 years ago

I referred this blog. http://blog.akismet.com/2012/07/20/pro-tip-testing-testing/

To simulate a negative (not spam) result, make a comment-check API call with the user_role set to administrator, and all other required fields populated with typical values.

joshfrench commented 9 years ago

Good catch! I should have time to put a patch together in the next few days. (Pull requests welcome, as well!)

joshfrench commented 9 years ago

I just pushed v1.5.1 to rubygems.org. Thanks for the patch!

takestar15 commented 9 years ago

Thanks.