From 0f3973a7c641a987410e31039e3e211a82cac926 Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Wed, 23 Feb 2011 19:54:07 -0300 Subject: [PATCH] Avoiding problems when request 'join_not_logged' via GET --- app/controllers/public/profile_controller.rb | 2 ++ test/functional/profile_controller_test.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 25b3bc6..6f287fa 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -105,6 +105,8 @@ class ProfileController < PublicController end if request.xhr? render :layout => false + else + redirect_to profile.url end end end diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 13ba103..88ddc10 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1159,4 +1159,13 @@ class ProfileControllerTest < Test::Unit::TestCase assert_tag :tag => 'div', :content => /#{plugin1_tab[:content]}/, :attributes => {:id => /#{plugin1_tab[:id]}/} end + should 'redirect to profile page when try to request join_not_logged via GET method' do + community = Community.create!(:name => 'my test community') + login_as(profile.identifier) + get :join_not_logged, :profile => community.identifier + assert_nothing_raised do + assert_redirected_to community.url + end + end + end -- libgit2 0.21.2