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
##
# Get a feed of recent changeset comments
- def comments_feed
+ def index
if params[:id]
# Extract the arguments
id = params[:id].to_i
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"
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]
)
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
##
# 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
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
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
##
# 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