public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
Get ready to tell Defensio if the person posting the comment is a trusted 
user or not.

Right now, ApplicationController has #admin?, but I can't use it in 
Mephisto#dispatch, because the correct before_filters aren't run.
francois (author)
Fri Mar 07 06:51:46 -0800 2008
commit  429ecf2948716ebb2905174653643eba4299a97e
tree    2979eb47fed9cd8cca2404211066956fc0eaaf9f
parent  5460e71c367d46d55c290804d2c2981052977a04
...
48
49
50
51
 
52
53
54
...
48
49
50
 
51
52
53
54
0
@@ -48,7 +48,7 @@ class MephistoController < ApplicationController
0
       end
0
 
0
       @comment = @article.comments.build(params[:comment].merge(:user_id => session[:user], :author_ip => request.remote_ip, :user_agent => request.user_agent, :referrer => request.referer))
0
- @comment.check_approval site, request if @comment.valid?
0
+ @comment.check_approval(site, request, :authenticated => admin?) if @comment.valid?
0
       @comment.save!
0
       redirect_to dispatch_path(:path => (site.permalink_for(@article)[1..-1].split('/') << 'comments' << @comment.id.to_s), :anchor => @comment.dom_id)
0
     rescue ActiveRecord::RecordInvalid
...
59
60
61
62
63
 
 
 
64
65
66
...
59
60
61
 
 
62
63
64
65
66
67
0
@@ -59,8 +59,9 @@ class Comment < Content
0
     "[#{article_id}:Article]"
0
   end
0
 
0
- def check_approval(site, request)
0
- self.approved = site.approve_comments? || spam_engine(site).ham?(article.permalink_url(site, request), self)
0
+ def check_approval(site, request, options={})
0
+ options.reverse_merge!(:authenticated => false)
0
+ self.approved = site.approve_comments? || spam_engine(site).ham?(article.permalink_url(site, request), self, :authenticated => options[:authenticated])
0
   end
0
 
0
   def mark_as_spam(site, request)
...
53
54
55
56
 
57
58
59
...
53
54
55
 
56
57
58
59
0
@@ -53,7 +53,7 @@ module Mephisto
0
       end
0
 
0
       # Determines if a single comment is either ham or spam.
0
- def ham?(permalink_url, comment)
0
+ def ham?(permalink_url, comment, options={})
0
         raise SubclassResponsibilityError
0
       end
0
 
...
17
18
19
20
 
21
22
23
...
17
18
19
 
20
21
22
23
0
@@ -17,7 +17,7 @@ module Mephisto
0
       def announce_article(permalink_url, article)
0
       end
0
 
0
- def ham?(permalink_url, comment)
0
+ def ham?(permalink_url, comment, options={})
0
         check_valid!
0
         !akismet.comment_check(comment_spam_options(permalink_url, comment))
0
       end
...
54
55
56
57
 
58
59
60
...
68
69
70
71
72
 
 
73
74
75
...
54
55
56
 
57
58
59
60
...
68
69
70
 
 
71
72
73
74
75
0
@@ -54,7 +54,7 @@ module Mephisto
0
         end
0
       end
0
 
0
- def ham?(permalink_url, comment)
0
+ def ham?(permalink_url, comment, options={})
0
         response = defensio.audit_comment(
0
           # Required parameters
0
           :user_ip => comment.author_ip,
0
@@ -68,8 +68,8 @@ module Mephisto
0
           :comment_author_url => comment.author_url,
0
           :permalink => permalink_url,
0
           :referrer => comment.referrer,
0
- :user_logged_in => false,
0
- :trusted_user => false
0
+ :user_logged_in => options[:authenticated],
0
+ :trusted_user => options[:authenticated]
0
         )
0
 
0
         comment.update_attribute(:spam_engine_data, {:signature => response.signature, :spaminess => response.spaminess.to_f})
...
20
21
22
23
 
24
25
26
...
20
21
22
 
23
24
25
26
0
@@ -20,7 +20,7 @@ module Mephisto
0
       def announce_article(permalink_url, article)
0
       end
0
 
0
- def ham?(permalink_url, comment)
0
+ def ham?(permalink_url, comment, options={})
0
         true
0
       end
0
 

Comments

    No one has commented yet.