From 899795a82b584d802ea67f8cb01fc0130bf92804 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 19 Jan 2025 01:54:07 +0300 Subject: [PATCH] Rename diary_comments_path to user_diary_comments_path --- app/views/users/show.html.erb | 4 ++-- config/routes.rb | 2 +- test/controllers/diary_comments_controller_test.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b2247c0d0..8ef7b5644 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -26,7 +26,7 @@ <%= number_with_delimiter(current_user.diary_entries.size) %>
  • - <%= link_to t(".my comments"), diary_comments_path(current_user) %> + <%= link_to t(".my comments"), user_diary_comments_path(current_user) %> <%= number_with_delimiter(current_user.diary_comments.size) %>
  • @@ -78,7 +78,7 @@ <%= number_with_delimiter(@user.diary_entries.size) %>
  • - <%= link_to t(".comments"), diary_comments_path(@user) %> + <%= link_to t(".comments"), user_diary_comments_path(@user) %> <%= number_with_delimiter(@user.diary_comments.size) %>
  • <% if current_user %> diff --git a/config/routes.rb b/config/routes.rb index 9e82a037d..a5528a895 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -247,7 +247,7 @@ OpenStreetMap::Application.routes.draw do 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", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary/comments") - get "/user/:display_name/diary/comments" => "diary_comments#index", :as => :diary_comments + get "/user/:display_name/diary/comments" => "diary_comments#index", :as => :user_diary_comments get "/user/:display_name/diary" => "diary_entries#index" get "/diary/:language" => "diary_entries#index" scope "/user/:display_name" do diff --git a/test/controllers/diary_comments_controller_test.rb b/test/controllers/diary_comments_controller_test.rb index f6ba6af65..3ee9959db 100644 --- a/test/controllers/diary_comments_controller_test.rb +++ b/test/controllers/diary_comments_controller_test.rb @@ -36,7 +36,7 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest deleted_user = create(:user, :deleted) # Test a user with no comments - get diary_comments_path(user) + get user_diary_comments_path(user) assert_response :success assert_template :index assert_select "h4", :html => "No diary comments" @@ -44,7 +44,7 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest # Test a user with a comment create(:diary_comment, :user => other_user) - get diary_comments_path(other_user) + get user_diary_comments_path(other_user) assert_response :success assert_template :index assert_dom "a[href='#{user_path(other_user)}']", :text => other_user.display_name @@ -53,11 +53,11 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest end # Test a suspended user - get diary_comments_path(suspended_user) + get user_diary_comments_path(suspended_user) assert_response :not_found # Test a deleted user - get diary_comments_path(deleted_user) + get user_diary_comments_path(deleted_user) assert_response :not_found end @@ -65,10 +65,10 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest user = create(:user) %w[-1 0 fred].each do |id| - get diary_comments_path(user, :before => id) + get user_diary_comments_path(user, :before => id) assert_redirected_to :controller => :errors, :action => :bad_request - get diary_comments_path(user, :after => id) + get user_diary_comments_path(user, :after => id) assert_redirected_to :controller => :errors, :action => :bad_request end end -- 2.39.5