From de6aa3f01512986cf9690def3e9004f755da750a Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 5 Sep 2018 15:17:11 +0800 Subject: [PATCH 1/1] Rename changeset#list to changeset#index --- app/controllers/changeset_controller.rb | 22 ++-- app/helpers/changeset_helper.rb | 10 +- app/views/changeset/history.html.erb | 4 +- .../{list.atom.builder => index.atom.builder} | 4 +- .../{list.html.erb => index.html.erb} | 0 app/views/user/view.html.erb | 4 +- config/locales/en.yml | 2 +- config/routes.rb | 8 +- test/controllers/changeset_controller_test.rb | 118 +++++++++--------- 9 files changed, 86 insertions(+), 86 deletions(-) rename app/views/changeset/{list.atom.builder => index.atom.builder} (95%) rename app/views/changeset/{list.html.erb => index.html.erb} (100%) diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 56fab0fc4..79192754b 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -4,19 +4,19 @@ class ChangesetController < ApplicationController layout "site" require "xml/libxml" - skip_before_action :verify_authenticity_token, :except => [:list] - before_action :authorize_web, :only => [:list, :feed, :comments_feed] - before_action :set_locale, :only => [:list, :feed, :comments_feed] + skip_before_action :verify_authenticity_token, :except => [:index] + before_action :authorize_web, :only => [:index, :feed, :comments_feed] + before_action :set_locale, :only => [:index, :feed, :comments_feed] before_action :authorize, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment] before_action :require_moderator, :only => [:hide_comment, :unhide_comment] before_action :require_allow_write_api, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment] before_action :require_public_data, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe] before_action :check_api_writable, :only => [:create, :update, :upload, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment] - before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :list, :feed, :comment, :subscribe, :unsubscribe, :comments_feed] - before_action(:only => [:list, :feed, :comments_feed]) { |c| c.check_database_readable(true) } - around_action :api_call_handle_error, :except => [:list, :feed, :comments_feed] - around_action :api_call_timeout, :except => [:list, :feed, :comments_feed, :upload] - around_action :web_timeout, :only => [:list, :feed, :comments_feed] + before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :index, :feed, :comment, :subscribe, :unsubscribe, :comments_feed] + before_action(:only => [:index, :feed, :comments_feed]) { |c| c.check_database_readable(true) } + around_action :api_call_handle_error, :except => [:index, :feed, :comments_feed] + around_action :api_call_timeout, :except => [:index, :feed, :comments_feed, :upload] + around_action :web_timeout, :only => [:index, :feed, :comments_feed] # Helper methods for checking consistency include ConsistencyValidations @@ -255,7 +255,7 @@ class ChangesetController < ApplicationController ## # list non-empty changesets in reverse chronological order - def list + def index @params = params.permit(:display_name, :bbox, :friends, :nearby, :max_id, :list) if request.format == :atom && @params[:max_id] @@ -300,14 +300,14 @@ class ChangesetController < ApplicationController @edits = changesets.order("changesets.id DESC").limit(20).preload(:user, :changeset_tags, :comments) - render :action => :list, :layout => false + render :action => :index, :layout => false end end ## # list edits as an atom feed def feed - list + index end ## diff --git a/app/helpers/changeset_helper.rb b/app/helpers/changeset_helper.rb index 7eb389023..539e6c309 100644 --- a/app/helpers/changeset_helper.rb +++ b/app/helpers/changeset_helper.rb @@ -32,15 +32,15 @@ module ChangesetHelper end end - def changeset_list_title(params, user) + def changeset_index_title(params, user) if params[:friends] && user - t "changeset.list.title_friend" + t "changeset.index.title_friend" elsif params[:nearby] && user - t "changeset.list.title_nearby" + t "changeset.index.title_nearby" elsif params[:display_name] - t "changeset.list.title_user", :user => params[:display_name] + t "changeset.index.title_user", :user => params[:display_name] else - t "changeset.list.title" + t "changeset.index.title" end end end diff --git a/app/views/changeset/history.html.erb b/app/views/changeset/history.html.erb index 17faf7f8d..bd8c24703 100644 --- a/app/views/changeset/history.html.erb +++ b/app/views/changeset/history.html.erb @@ -5,9 +5,9 @@ <% end -%> <% - set_title(changeset_list_title(params, current_user)) + set_title(changeset_index_title(params, current_user)) if params[:display_name] - @heading = t('changeset.list.title_user', :user => link_to(params[:display_name], :controller => "user", :action => "view", :display_name => params[:display_name])).html_safe + @heading = t('changeset.index.title_user', :user => link_to(params[:display_name], :controller => "user", :action => "view", :display_name => params[:display_name])).html_safe else @heading = @title end diff --git a/app/views/changeset/list.atom.builder b/app/views/changeset/index.atom.builder similarity index 95% rename from app/views/changeset/list.atom.builder rename to app/views/changeset/index.atom.builder index 86dd966cc..b21d77728 100644 --- a/app/views/changeset/list.atom.builder +++ b/app/views/changeset/index.atom.builder @@ -1,8 +1,8 @@ atom_feed(:language => I18n.locale, :schema_date => 2009, :id => url_for(@params.merge(:only_path => false)), - :root_url => url_for(@params.merge(:action => :list, :format => nil, :only_path => false)), + :root_url => url_for(@params.merge(:action => :index, :format => nil, :only_path => false)), "xmlns:georss" => "http://www.georss.org/georss") do |feed| - feed.title changeset_list_title(params, current_user) + feed.title changeset_index_title(params, current_user) feed.updated @edits.map { |e| [e.created_at, e.closed_at].max }.max feed.icon image_url("favicon.ico") diff --git a/app/views/changeset/list.html.erb b/app/views/changeset/index.html.erb similarity index 100% rename from app/views/changeset/list.html.erb rename to app/views/changeset/index.html.erb diff --git a/app/views/user/view.html.erb b/app/views/user/view.html.erb index 0e99a2861..0b48d28d2 100644 --- a/app/views/user/view.html.erb +++ b/app/views/user/view.html.erb @@ -7,7 +7,7 @@