]> git.openstreetmap.org Git - rails.git/commitdiff
Redirect from old diary comments pagination
authorAnton Khorev <tony29@yandex.ru>
Fri, 29 Mar 2024 05:09:26 +0000 (08:09 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 29 Mar 2024 05:09:26 +0000 (08:09 +0300)
config/routes.rb
test/controllers/diary_entries_controller_test.rb

index 1633e2b26beda6d428d3ccc708e5b0f4f5ef2d64..d006648323b8f866d57a05c76281536e5d2e36fc 100644 (file)
@@ -236,8 +236,8 @@ OpenStreetMap::Application.routes.draw do
   get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
   get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
   get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
-  get "/user/:display_name/diary/comments/:page" => "diary_entries#comments", :page => /[1-9][0-9]*/
-  get "/user/:display_name/diary/comments/" => "diary_entries#comments", :as => :diary_comments
+  get "/user/:display_name/diary/comments/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary/comments")
+  get "/user/:display_name/diary/comments" => "diary_entries#comments", :as => :diary_comments
   get "/user/:display_name/diary" => "diary_entries#index"
   get "/diary/:language" => "diary_entries#index"
   scope "/user/:display_name" do
index 94b7069758029f588fddd24d49035037082276c1..2b10402fa04cd14d159e3d3c76749cb42f758aab 100644 (file)
@@ -53,10 +53,6 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
       { :path => "/user/username/diary/comments", :method => :get },
       { :controller => "diary_entries", :action => "comments", :display_name => "username" }
     )
-    assert_routing(
-      { :path => "/user/username/diary/comments/1", :method => :get },
-      { :controller => "diary_entries", :action => "comments", :display_name => "username", :page => "1" }
-    )
 
     assert_routing(
       { :path => "/diary/new", :method => :get },
@@ -114,6 +110,9 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
       { :path => "/user/username/diary/1/unsubscribe", :method => :post },
       { :controller => "diary_entries", :action => "unsubscribe", :display_name => "username", :id => "1" }
     )
+
+    get "/user/username/diary/comments/1"
+    assert_redirected_to "/user/username/diary/comments"
   end
 
   def test_new_no_login