From: Anton Khorev Date: Tue, 23 Jul 2024 16:00:02 +0000 (+0300) Subject: Change diary comment post paths X-Git-Tag: live~349^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a2aa44e026f0f796f046a58d2ad3778e6e79f960 Change diary comment post paths --- diff --git a/config/routes.rb b/config/routes.rb index 0d1df9678..12f6325ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -237,13 +237,13 @@ OpenStreetMap::Application.routes.draw do scope "/user/:display_name" do resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ end - post "/user/:display_name/diary/:id/newcomment" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry post "/user/:display_name/diary/:id/unhide" => "diary_entries#unhide", :id => /\d+/, :as => :unhide_diary_entry - post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_comments#hide", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment - post "/user/:display_name/diary/:id/unhidecomment/:comment" => "diary_comments#unhide", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/ match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/ + post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry + post "/user/:display_name/diary/:id/comments/:comment/hide" => "diary_comments#hide", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment + post "/user/:display_name/diary/:id/comments/:comment/unhide" => "diary_comments#unhide", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment # user pages resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy] diff --git a/test/controllers/diary_comments_controller_test.rb b/test/controllers/diary_comments_controller_test.rb index 2ebf52d16..fa978d606 100644 --- a/test/controllers/diary_comments_controller_test.rb +++ b/test/controllers/diary_comments_controller_test.rb @@ -13,15 +13,15 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest { :controller => "diary_comments", :action => "index", :display_name => "username" } ) assert_routing( - { :path => "/user/username/diary/1/newcomment", :method => :post }, + { :path => "/user/username/diary/1/comments", :method => :post }, { :controller => "diary_comments", :action => "create", :display_name => "username", :id => "1" } ) assert_routing( - { :path => "/user/username/diary/1/hidecomment/2", :method => :post }, + { :path => "/user/username/diary/1/comments/2/hide", :method => :post }, { :controller => "diary_comments", :action => "hide", :display_name => "username", :id => "1", :comment => "2" } ) assert_routing( - { :path => "/user/username/diary/1/unhidecomment/2", :method => :post }, + { :path => "/user/username/diary/1/comments/2/unhide", :method => :post }, { :controller => "diary_comments", :action => "unhide", :display_name => "username", :id => "1", :comment => "2" } )