]> git.openstreetmap.org Git - rails.git/commitdiff
Rename comments_feed to index
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 7 Nov 2018 08:58:21 +0000 (09:58 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 7 Nov 2018 09:22:07 +0000 (10:22 +0100)
app/controllers/changeset_comments_controller.rb
app/views/changeset_comments/index.rss.builder [moved from app/views/changeset_comments/comments_feed.rss.builder with 100% similarity]
config/routes.rb
test/controllers/changeset_comments_controller_test.rb

index 21bd58e65394d2ab5d7015c2f2bcb1174b0d4a54..856b12f20e587063c24f80271e41d31c012c6c66 100644 (file)
@@ -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
index cf4fefcda8f3efcdce81ce00a4c6d122e240518c..20c3e253c71e53394c366a002482271ae0def588 100644 (file)
@@ -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]
index ed15d34a892c9632156b32390b371d57497ac0cd..67df9aa882f7910875190afa4bcec860138bf243 100644 (file)
@@ -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