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
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
Change comments so that the text filter is taken from the site, not the 
article

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2118 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Sep 08 20:22:28 -0700 2006
commit  f46461ab0680772d13c7bd6038a757ab1c24a754
tree    7389561136f4e77263361a6b0b66baab2ae9ef4b
parent  a9a307684ae8d4d7c32e9ee6c5b8b32703c703b8
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 * SVN *
0
 
0
+* Change comments so that the text filter is taken from the site, not the article
0
+
0
 * Integrate referenced page caching into the app.
0
 
0
 * Add Comment validations and better error messages [Geoff Davis]
...
6
7
8
9
10
11
12
...
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
6
7
8
 
9
10
11
...
163
164
165
 
 
 
 
 
 
 
 
 
 
 
 
166
167
0
@@ -6,7 +6,6 @@ class Article < Content
0
   before_validation { |record| record.set_default_filter! }
0
   after_validation :convert_to_utc
0
   before_create :create_permalink
0
- before_save :pass_filter_to_comments
0
   after_save :save_assigned_sections
0
 
0
   acts_as_versioned :if_changed => [:title, :body, :excerpt], :limit => 5 do
0
@@ -164,16 +163,4 @@ class Article < Content
0
     
0
       @new_sections = nil
0
     end
0
-
0
- def pass_filter_to_comments
0
- return unless @old_filter
0
- self.record_timestamps = false
0
- CommentObserver.disabled = true
0
- comments.each { |c| c.update_attributes(:filter => filter) }
0
- @old_filter = nil
0
- true
0
- ensure
0
- self.record_timestamps = true
0
- CommentObserver.disabled = false
0
- end
0
 end
0
\ No newline at end of file
...
40
41
42
43
 
44
45
46
...
40
41
42
 
43
44
45
46
0
@@ -40,7 +40,7 @@ class Comment < Content
0
 
0
   protected
0
     def snag_article_filter_and_site
0
- self.attributes = { :site_id => article.site_id, :filter => article.filter }
0
+ self.attributes = { :site => article.site, :filter => article.site.filter }
0
     end
0
 
0
     def check_comment_expiration
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@ first:
0
   id: 1
0
   title: Mephisto
0
   host: test.com
0
- filter: foo
0
+ filter: textile_filter
0
   approve_comments: false
0
   comment_age: 30
0
   timezone: America/New_York
...
49
50
51
 
 
 
 
 
 
 
 
52
53
54
55
56
57
58
59
 
60
61
62
...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
 
66
67
68
69
0
@@ -49,14 +49,21 @@ class ArticleTest < Test::Unit::TestCase
0
 
0
   def test_should_modify_filter
0
     assert_equal 'textile_filter', contents(:welcome).filter
0
+
0
+ contents(:welcome).filter = 'markdown_filter'
0
+ contents(:welcome).save
0
+
0
+ assert_equal 'markdown_filter', contents(:welcome).reload.filter
0
+ end
0
+
0
+ def test_should_modify_filter_and_leave_comments_alone
0
     assert_equal 'textile_filter', contents(:welcome_comment).filter
0
     old_time = contents(:welcome_comment)
0
     
0
     contents(:welcome).filter = 'markdown_filter'
0
     contents(:welcome).save
0
 
0
- assert_equal 'markdown_filter', contents(:welcome).reload.filter
0
- assert_equal 'markdown_filter', contents(:welcome_comment).reload.filter
0
+ assert_equal 'textile_filter', contents(:welcome_comment).reload.filter
0
   end
0
 
0
   def test_should_modify_filter_and_not_modify_comment_timestamps
...
1
2
3
4
 
5
6
7
...
40
41
42
 
 
43
44
45
...
1
2
3
 
4
5
6
7
...
40
41
42
43
44
45
46
47
0
@@ -1,7 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class CommentDropTest < Test::Unit::TestCase
0
- fixtures :contents
0
+ fixtures :contents, :sites
0
   
0
   def setup
0
     @comment = Mephisto::Liquid::CommentDrop.new(contents(:welcome_comment))
0
@@ -40,6 +40,8 @@ class CommentDropTest < Test::Unit::TestCase
0
   
0
   def test_should_show_filtered_text
0
     comment = contents(:welcome).comments.create :body => '*test* comment', :author => 'bob', :author_ip => '127.0.0.1', :filter => 'textile_filter'
0
+ assert_valid comment
0
+ assert_equal 'textile_filter', comment.filter
0
     liquid = comment.to_liquid
0
     assert_equal '<p><strong>test</strong> comment</p>', liquid.before_method(:body)
0
   end

Comments

    No one has commented yet.