diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index ac3ede9..0fd3295 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -3,7 +3,7 @@ class ProfileController < PublicController needs_profile before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index] before_filter :store_before_join, :only => [:join, :join_not_logged] - before_filter :login_required, :only => [:join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_scraps, :view_more_activities, :view_more_network_activities] + before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_scraps, :view_more_activities, :view_more_network_activities] helper TagsHelper @@ -121,6 +121,10 @@ class ProfileController < PublicController end def check_membership + unless logged_in? + render :text => '' + return + end if user.memberships.include?(profile) render :text => 'true' else @@ -139,6 +143,10 @@ class ProfileController < PublicController end def check_friendship + unless logged_in? + render :text => '' + return + end if user == profile || user.already_request_friendship?(profile) || user.is_a_friend?(profile) render :text => 'true' else diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index ee1ac7c..1853b33 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1038,4 +1038,14 @@ class ProfileControllerTest < Test::Unit::TestCase assert_redirected_to :controller => 'account', :action => 'login' end + should 'render empty response for not logged in users in check_membership' do + get :check_membership + assert_equal '', @response.body + end + + should 'render empty response for not logged in users in check_friendship' do + get :check_friendship + assert_equal '', @response.body + end + end -- libgit2 0.21.2