Commit ebdbd8ac957ea2876dad91813d1672afba023ce7
1 parent
ffbf0914
Exists in
master
and in
28 other branches
Removed unused method
It's not used anymore since: ca5ebf95375cd5dbb80a047dc79f4c31e36df899
Showing
2 changed files
with
1 additions
and
18 deletions
Show diff stats
test/unit/comment_test.rb
| @@ -293,7 +293,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -293,7 +293,7 @@ class CommentTest < ActiveSupport::TestCase | ||
| 293 | c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) | 293 | c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) |
| 294 | c3 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) | 294 | c3 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) |
| 295 | c4 = Comment.create!(:source => a, :body => 'My comment', :author => person) | 295 | c4 = Comment.create!(:source => a, :body => 'My comment', :author => person) |
| 296 | - result = a.activity.comments_as_thread | 296 | + result = a.activity.comments |
| 297 | assert_equal c0, result[0] | 297 | assert_equal c0, result[0] |
| 298 | assert_equal [c1, c3], result[0].replies | 298 | assert_equal [c1, c3], result[0].replies |
| 299 | assert_equal [c2], result[0].replies[0].replies | 299 | assert_equal [c2], result[0].replies[0].replies |
vendor/plugins/action_tracker_has_comments/init.rb
| @@ -12,22 +12,5 @@ Rails.configuration.to_prepare do | @@ -12,22 +12,5 @@ Rails.configuration.to_prepare do | ||
| 12 | "source_type = '#{type}' AND source_id = '#{id}' AND spam IS NOT TRUE AND reply_of_id IS NULL" | 12 | "source_type = '#{type}' AND source_id = '#{id}' AND spam IS NOT TRUE AND reply_of_id IS NULL" |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | - def comments_as_thread | ||
| 16 | - result = {} | ||
| 17 | - root = [] | ||
| 18 | - self.comments.each do |c| | ||
| 19 | - c.replies = [] | ||
| 20 | - result[c.id] ||= c | ||
| 21 | - if c.reply_of_id.nil? | ||
| 22 | - root << c | ||
| 23 | - elsif result[c.reply_of_id] | ||
| 24 | - result[c.reply_of_id].replies << c | ||
| 25 | - else # Comment is a reply but the reply is not being displayed - is spam, for example | ||
| 26 | - root << c | ||
| 27 | - end | ||
| 28 | - end | ||
| 29 | - root | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | end | 15 | end |
| 33 | end | 16 | end |