From: Andy Allan Date: Wed, 7 Nov 2018 08:58:21 +0000 (+0100) Subject: Rename comments_feed to index X-Git-Tag: live~2777^2~3 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/4b0d56f7e15d2929c973265e3b545e69273b8cb5 Rename comments_feed to index --- diff --git a/app/controllers/changeset_comments_controller.rb b/app/controllers/changeset_comments_controller.rb index 21bd58e65..856b12f20 100644 --- a/app/controllers/changeset_comments_controller.rb +++ b/app/controllers/changeset_comments_controller.rb @@ -1,16 +1,16 @@ class ChangesetCommentsController < ApplicationController - before_action :authorize_web, :only => [:comments_feed] - before_action :set_locale, :only => [:comments_feed] + before_action :authorize_web, :only => [:index] + before_action :set_locale, :only => [:index] before_action :authorize, :only => [:create, :hide_comment, :unhide_comment] before_action :require_moderator, :only => [:hide_comment, :unhide_comment] before_action :require_allow_write_api, :only => [:create, :hide_comment, :unhide_comment] before_action :require_public_data, :only => [:create] before_action :check_api_writable, :only => [:create, :hide_comment, :unhide_comment] - before_action :check_api_readable, :except => [:create, :comments_feed] - before_action(:only => [:comments_feed]) { |c| c.check_database_readable(true) } - around_action :api_call_handle_error, :except => [:comments_feed] - around_action :api_call_timeout, :except => [:comments_feed] - around_action :web_timeout, :only => [:comments_feed] + before_action :check_api_readable, :except => [:create, :index] + before_action(:only => [:index]) { |c| c.check_database_readable(true) } + around_action :api_call_handle_error, :except => [:index] + around_action :api_call_timeout, :except => [:index] + around_action :web_timeout, :only => [:index] ## # Add a comment to a changeset @@ -84,7 +84,7 @@ class ChangesetCommentsController < ApplicationController ## # Get a feed of recent changeset comments - def comments_feed + def index if params[:id] # Extract the arguments id = params[:id].to_i diff --git a/app/views/changeset_comments/comments_feed.rss.builder b/app/views/changeset_comments/index.rss.builder similarity index 100% rename from app/views/changeset_comments/comments_feed.rss.builder rename to app/views/changeset_comments/index.rss.builder diff --git a/config/routes.rb b/config/routes.rb index cf4fefcda..20c3e253c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -116,7 +116,7 @@ OpenStreetMap::Application.routes.draw do get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation get "/relation/:id/history" => "browse#relation_history", :id => /\d+/ get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/ - get "/changeset/:id/comments/feed" => "changeset_comments#comments_feed", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } + get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } get "/note/:id" => "browse#note", :id => /\d+/, :as => "browse_note" get "/note/new" => "browse#new_note" get "/user/:display_name/history" => "changeset#index" @@ -152,7 +152,7 @@ OpenStreetMap::Application.routes.draw do get "/about" => "site#about" get "/history" => "changeset#index" get "/history/feed" => "changeset#feed", :defaults => { :format => :atom } - get "/history/comments/feed" => "changeset_comments#comments_feed", :as => :changesets_comments_feed, :defaults => { :format => "rss" } + get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" } get "/export" => "site#export" match "/login" => "users#login", :via => [:get, :post] match "/logout" => "users#logout", :via => [:get, :post] diff --git a/test/controllers/changeset_comments_controller_test.rb b/test/controllers/changeset_comments_controller_test.rb index ed15d34a8..67df9aa88 100644 --- a/test/controllers/changeset_comments_controller_test.rb +++ b/test/controllers/changeset_comments_controller_test.rb @@ -18,11 +18,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ) assert_routing( { :path => "/changeset/1/comments/feed", :method => :get }, - { :controller => "changeset_comments", :action => "comments_feed", :id => "1", :format => "rss" } + { :controller => "changeset_comments", :action => "index", :id => "1", :format => "rss" } ) assert_routing( { :path => "/history/comments/feed", :method => :get }, - { :controller => "changeset_comments", :action => "comments_feed", :format => "rss" } + { :controller => "changeset_comments", :action => "index", :format => "rss" } ) end @@ -207,11 +207,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ## # test comments feed - def test_comments_feed + def test_feed changeset = create(:changeset, :closed) create_list(:changeset_comment, 3, :changeset => changeset) - get :comments_feed, :params => { :format => "rss" } + get :index, :params => { :format => "rss" } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -220,7 +220,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase end end - get :comments_feed, :params => { :format => "rss", :limit => 2 } + get :index, :params => { :format => "rss", :limit => 2 } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -229,7 +229,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase end end - get :comments_feed, :params => { :id => changeset.id, :format => "rss" } + get :index, :params => { :id => changeset.id, :format => "rss" } assert_response :success assert_equal "application/rss+xml", @response.content_type assert_select "rss", :count => 1 do @@ -241,11 +241,11 @@ class ChangesetCommentsControllerTest < ActionController::TestCase ## # test comments feed - def test_comments_feed_bad_limit - get :comments_feed, :params => { :format => "rss", :limit => 0 } + def test_feed_bad_limit + get :index, :params => { :format => "rss", :limit => 0 } assert_response :bad_request - get :comments_feed, :params => { :format => "rss", :limit => 100001 } + get :index, :params => { :format => "rss", :limit => 100001 } assert_response :bad_request end end