From ebdbd8ac957ea2876dad91813d1672afba023ce7 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Fri, 7 Mar 2014 10:11:05 +0000 Subject: [PATCH] Removed unused method --- test/unit/comment_test.rb | 2 +- vendor/plugins/action_tracker_has_comments/init.rb | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index f845e52..3cb1dd9 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -293,7 +293,7 @@ class CommentTest < ActiveSupport::TestCase c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) c3 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) c4 = Comment.create!(:source => a, :body => 'My comment', :author => person) - result = a.activity.comments_as_thread + result = a.activity.comments assert_equal c0, result[0] assert_equal [c1, c3], result[0].replies assert_equal [c2], result[0].replies[0].replies diff --git a/vendor/plugins/action_tracker_has_comments/init.rb b/vendor/plugins/action_tracker_has_comments/init.rb index e20e511..37d1bf7 100644 --- a/vendor/plugins/action_tracker_has_comments/init.rb +++ b/vendor/plugins/action_tracker_has_comments/init.rb @@ -12,22 +12,5 @@ Rails.configuration.to_prepare do "source_type = '#{type}' AND source_id = '#{id}' AND spam IS NOT TRUE AND reply_of_id IS NULL" end - def comments_as_thread - result = {} - root = [] - self.comments.each do |c| - c.replies = [] - result[c.id] ||= c - if c.reply_of_id.nil? - root << c - elsif result[c.reply_of_id] - result[c.reply_of_id].replies << c - else # Comment is a reply but the reply is not being displayed - is spam, for example - root << c - end - end - root - end - end end -- libgit2 0.21.2