Commit 8e8f96761f61948c18a57a1e1461eb8d85273519
1 parent
74537cad
Exists in
master
and in
29 other branches
Fix redirection to renamed articles in profiles with their own domain
ActionItem2420
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
| @@ -19,7 +19,7 @@ class ContentViewerController < ApplicationController | @@ -19,7 +19,7 @@ class ContentViewerController < ApplicationController | ||
| 19 | unless @page | 19 | unless @page |
| 20 | page_from_old_path = profile.articles.find_by_old_path(path) | 20 | page_from_old_path = profile.articles.find_by_old_path(path) |
| 21 | if page_from_old_path | 21 | if page_from_old_path |
| 22 | - redirect_to :profile => profile.identifier, :page => page_from_old_path.explode_path | 22 | + redirect_to profile.url.merge(:page => page_from_old_path.explode_path) |
| 23 | return | 23 | return |
| 24 | end | 24 | end |
| 25 | end | 25 | end |
test/functional/content_viewer_controller_test.rb
| @@ -474,7 +474,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -474,7 +474,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 474 | get :view_page, :profile => p.identifier, :page => old_path | 474 | get :view_page, :profile => p.identifier, :page => old_path |
| 475 | 475 | ||
| 476 | assert_response :redirect | 476 | assert_response :redirect |
| 477 | - assert_redirected_to :profile => p.identifier, :page => a.explode_path | 477 | + assert_redirected_to :host => p.default_hostname, :controller => 'content_viewer', :action => 'view_page', :profile => p.identifier, :page => a.explode_path |
| 478 | end | 478 | end |
| 479 | 479 | ||
| 480 | should 'load new article name equal of another article old name' do | 480 | should 'load new article name equal of another article old name' do |
| @@ -503,7 +503,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -503,7 +503,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 503 | get :view_page, :profile => p.identifier, :page => old_path | 503 | get :view_page, :profile => p.identifier, :page => old_path |
| 504 | 504 | ||
| 505 | assert_response :redirect | 505 | assert_response :redirect |
| 506 | - assert_redirected_to :profile => p.identifier, :page => a2.explode_path | 506 | + assert_redirected_to :host => p.default_hostname, :controller => 'content_viewer', :action => 'view_page', :profile => p.identifier, :page => a2.explode_path |
| 507 | end | 507 | end |
| 508 | 508 | ||
| 509 | should 'not return an article of a different user' do | 509 | should 'not return an article of a different user' do |