diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 2463ae0..2275cd0 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -211,8 +211,7 @@ class ProfileController < PublicController end def more_comments - activity_id = params[:activity].to_i - activity = ActionTracker::Record.find(:first, :conditions => {:id => activity_id, :user_id => @profile.id}) + activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity], :user_id => @profile}) comments_count = activity.comments.count comment_page = (params[:comment_page] || 1).to_i comments_per_page = 5 @@ -232,8 +231,7 @@ class ProfileController < PublicController end def more_replies - activity_id = params[:activity].to_i - activity = Scrap.find(:first, :conditions => {:id => activity_id, :receiver_id => @profile.id, :scrap_id => nil}) + activity = Scrap.find(:first, :conditions => {:id => params[:activity], :receiver_id => @profile, :scrap_id => nil}) comments_count = activity.replies.count comment_page = (params[:comment_page] || 1).to_i comments_per_page = 5 diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 21e262a..e262896 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -734,7 +734,7 @@ class ProfileControllerTest < ActionController::TestCase end should 'see the activities_items paginated' do - p1= Person.first + p1 = create_user('some').person ActionTracker::Record.destroy_all 40.times{Scrap.create!(defaults_for_scrap(:sender => p1, :receiver => p1))} login_as(p1.identifier) diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index fdd48f0..3b1fae1 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -285,22 +285,6 @@ class CommentTest < ActiveSupport::TestCase assert_equal [c1,c3], c.reload.children end - should "return activities comments as a thread" do - person = fast_create(Person) - a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') - c0 = Comment.create!(:source => a, :body => 'My comment', :author => person) - c1 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) - 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 - assert_equal c0, result[0] - assert_equal [c1, c3], result[0].replies - assert_equal [c2], result[0].replies[0].replies - assert_equal c4, result[1] - assert result[1].replies.empty? - end - should 'provide author url for authenticated user' do author = Person.new author.expects(:url).returns('http://blabla.net/author') -- libgit2 0.21.2