Rename diary_comments_path to user_diary_comments_path

This commit is contained in:
Anton Khorev 2025-01-19 01:54:07 +03:00
parent df1a9bb2c9
commit 899795a82b
3 changed files with 9 additions and 9 deletions

View file

@ -26,7 +26,7 @@
<span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
</li>
<li>
<%= link_to t(".my comments"), diary_comments_path(current_user) %>
<%= link_to t(".my comments"), user_diary_comments_path(current_user) %>
<span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
</li>
<li>
@ -78,7 +78,7 @@
<span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
</li>
<li>
<%= link_to t(".comments"), diary_comments_path(@user) %>
<%= link_to t(".comments"), user_diary_comments_path(@user) %>
<span class='badge count-number'><%= number_with_delimiter(@user.diary_comments.size) %></span>
</li>
<% if current_user %>

View file

@ -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

View file

@ -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