Commit 0f3973a7c641a987410e31039e3e211a82cac926
Committed by
Daniela Feitosa
1 parent
a815c2ef
Exists in
master
and in
28 other branches
Avoiding problems when request 'join_not_logged' via GET
(ActionItem1884)
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
app/controllers/public/profile_controller.rb
| @@ -105,6 +105,8 @@ class ProfileController < PublicController | @@ -105,6 +105,8 @@ class ProfileController < PublicController | ||
| 105 | end | 105 | end |
| 106 | if request.xhr? | 106 | if request.xhr? |
| 107 | render :layout => false | 107 | render :layout => false |
| 108 | + else | ||
| 109 | + redirect_to profile.url | ||
| 108 | end | 110 | end |
| 109 | end | 111 | end |
| 110 | end | 112 | end |
test/functional/profile_controller_test.rb
| @@ -1159,4 +1159,13 @@ class ProfileControllerTest < Test::Unit::TestCase | @@ -1159,4 +1159,13 @@ class ProfileControllerTest < Test::Unit::TestCase | ||
| 1159 | assert_tag :tag => 'div', :content => /#{plugin1_tab[:content]}/, :attributes => {:id => /#{plugin1_tab[:id]}/} | 1159 | assert_tag :tag => 'div', :content => /#{plugin1_tab[:content]}/, :attributes => {:id => /#{plugin1_tab[:id]}/} |
| 1160 | end | 1160 | end |
| 1161 | 1161 | ||
| 1162 | + should 'redirect to profile page when try to request join_not_logged via GET method' do | ||
| 1163 | + community = Community.create!(:name => 'my test community') | ||
| 1164 | + login_as(profile.identifier) | ||
| 1165 | + get :join_not_logged, :profile => community.identifier | ||
| 1166 | + assert_nothing_raised do | ||
| 1167 | + assert_redirected_to community.url | ||
| 1168 | + end | ||
| 1169 | + end | ||
| 1170 | + | ||
| 1162 | end | 1171 | end |