public
Fork of halorgium/mephisto
Description: A refactored Mephisto that has multiple spam detection engines.
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/francois/mephisto.git
allow comments to set a filter and ignore the article's site filter

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2587 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Mon Dec 25 22:59:22 -0800 2006
commit  2f47be0a61f0c54611d56bd78aea7ed39895b889
tree    982b28b628ea9abf14fcbae9be0a1be0012fdb9e
parent  3380e83214007e9e0586e70d77a42e32e5a31d4f
...
68
69
70
71
 
 
72
73
74
...
68
69
70
 
71
72
73
74
75
0
@@ -68,7 +68,8 @@ class Comment < Content
0
 
0
   protected
0
     def snag_article_attributes
0
- self.attributes = { :site => article.site, :filter => article.site.filter, :title => article.title, :published_at => article.published_at, :permalink => article.permalink }
0
+ self.filter ||= article.site.filter
0
+ self.attributes = { :site => article.site, :title => article.title, :published_at => article.published_at, :permalink => article.permalink }
0
     end
0
 
0
     def check_comment_expiration
...
18
19
20
21
 
22
23
 
24
25
26
27
28
 
 
 
 
 
 
 
 
29
30
31
...
18
19
20
 
21
22
 
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0
@@ -18,14 +18,22 @@ class CommentTest < Test::Unit::TestCase
0
     end
0
   end
0
 
0
- def test_should_pass_filter_down_from_article
0
+ def test_should_pass_filter_down_from_article_site
0
     old_times = contents(:welcome).comments.collect &:updated_at
0
- comment = contents(:welcome).comments.create :body => 'test comment', :author => 'bob', :author_ip => '127.0.0.1', :filter => 'textile_filter'
0
+ comment = contents(:welcome).comments.create :body => 'test comment', :author => 'bob', :author_ip => '127.0.0.1'
0
     assert_equal 'textile_filter', comment.filter
0
     assert_valid comment
0
     assert_equal old_times, contents(:welcome).comments(true).collect(&:updated_at)
0
   end
0
 
0
+ def test_should_allow_set_filter_on_comment
0
+ old_times = contents(:welcome).comments.collect &:updated_at
0
+ comment = contents(:welcome).comments.create :body => 'test comment', :author => 'bob', :author_ip => '127.0.0.1', :filter => 'markdown_filter'
0
+ assert_equal 'markdown_filter', comment.filter
0
+ assert_valid comment
0
+ assert_equal old_times, contents(:welcome).comments(true).collect(&:updated_at)
0
+ end
0
+
0
   def test_should_process_textile_when_adding_comment
0
     c = contents(:welcome).comments.create :body => '*test* comment', :author => 'bob', :author_ip => '127.0.0.1'
0
     assert_equal "<p><strong>test</strong> comment</p>", c.body_html

Comments

    No one has commented yet.