From: Jean-Philippe Lang Date: Thu, 14 Jul 2016 07:27:31 +0000 (+0000) Subject: Use .before_action instead of .before_filter. X-Git-Tag: 3.4.0~808 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee82a55602a2178f9d5a978be3bf8492855d2c7f;p=redmine.git Use .before_action instead of .before_filter. git-svn-id: http://svn.redmine.org/redmine/trunk@15655 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 32df00f97..6b1f9bc61 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -17,7 +17,7 @@ class ActivitiesController < ApplicationController menu_item :activity - before_filter :find_optional_project + before_action :find_optional_project accept_rss_auth :index def index diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 944e60ca3..811845713 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -21,7 +21,7 @@ class AdminController < ApplicationController menu_item :plugins, :only => :plugins menu_item :info, :only => :info - before_filter :require_admin + before_action :require_admin helper :sort include SortHelper diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f998be775..6768d1647 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base end end - before_filter :session_expiration, :user_setup, :check_if_login_required, :check_password_change, :set_localization + before_action :session_expiration, :user_setup, :check_if_login_required, :check_password_change, :set_localization rescue_from ::Unauthorized, :with => :deny_access rescue_from ::ActionView::MissingTemplate, :with => :missing_template @@ -369,7 +369,7 @@ class ApplicationController < ActionController::Base end # make sure that the user is a member of the project (or admin) if project is private - # used as a before_filter for actions that do not require any particular permission on the project + # used as a before_action for actions that do not require any particular permission on the project def check_project_privacy if @project && !@project.archived? if @project.visible? diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ea45397ef..de61e8412 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -16,11 +16,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AttachmentsController < ApplicationController - before_filter :find_attachment, :only => [:show, :download, :thumbnail, :destroy] - before_filter :find_editable_attachments, :only => [:edit, :update] - before_filter :file_readable, :read_authorize, :only => [:show, :download, :thumbnail] - before_filter :delete_authorize, :only => :destroy - before_filter :authorize_global, :only => :upload + before_action :find_attachment, :only => [:show, :download, :thumbnail, :destroy] + before_action :find_editable_attachments, :only => [:edit, :update] + before_action :file_readable, :read_authorize, :only => [:show, :download, :thumbnail] + before_action :delete_authorize, :only => :destroy + before_action :authorize_global, :only => :upload accept_api_auth :show, :download, :thumbnail, :upload, :destroy diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb index 38bebc439..6f5e903d6 100644 --- a/app/controllers/auth_sources_controller.rb +++ b/app/controllers/auth_sources_controller.rb @@ -19,8 +19,8 @@ class AuthSourcesController < ApplicationController layout 'admin' menu_item :ldap_authentication - before_filter :require_admin - before_filter :find_auth_source, :only => [:edit, :update, :test_connection, :destroy] + before_action :require_admin + before_action :find_auth_source, :only => [:edit, :update, :test_connection, :destroy] require_sudo_mode :update, :destroy def index diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb index 92c0641d6..3fe572ab6 100644 --- a/app/controllers/auto_completes_controller.rb +++ b/app/controllers/auto_completes_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AutoCompletesController < ApplicationController - before_filter :find_project + before_action :find_project def issues @issues = [] diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index df2567fab..35e779370 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -17,7 +17,7 @@ class BoardsController < ApplicationController default_search_scope :messages - before_filter :find_project_by_project_id, :find_board_if_available, :authorize + before_action :find_project_by_project_id, :find_board_if_available, :authorize accept_rss_auth :index, :show helper :sort diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 276d7988d..880f0b8c2 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -17,7 +17,7 @@ class CalendarsController < ApplicationController menu_item :calendar - before_filter :find_optional_project + before_action :find_optional_project rescue_from Query::StatementInvalid, :with => :query_statement_invalid diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 5074ef631..9544caa1d 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -18,9 +18,9 @@ class CommentsController < ApplicationController default_search_scope :news model_object News - before_filter :find_model_object - before_filter :find_project_from_association - before_filter :authorize + before_action :find_model_object + before_action :find_project_from_association + before_action :authorize def create raise Unauthorized unless @news.commentable? diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index dc8e72609..39594012c 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -19,7 +19,7 @@ class ContextMenusController < ApplicationController helper :watchers helper :issues - before_filter :find_issues, :only => :issues + before_action :find_issues, :only => :issues def issues if (@issues.size == 1) diff --git a/app/controllers/custom_field_enumerations_controller.rb b/app/controllers/custom_field_enumerations_controller.rb index f99f770f4..05c5741b0 100644 --- a/app/controllers/custom_field_enumerations_controller.rb +++ b/app/controllers/custom_field_enumerations_controller.rb @@ -18,9 +18,9 @@ class CustomFieldEnumerationsController < ApplicationController layout 'admin' - before_filter :require_admin - before_filter :find_custom_field - before_filter :find_enumeration, :only => :destroy + before_action :require_admin + before_action :find_custom_field + before_action :find_enumeration, :only => :destroy helper :custom_fields diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index ab0d5019f..c0b4ac9e9 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -18,9 +18,9 @@ class CustomFieldsController < ApplicationController layout 'admin' - before_filter :require_admin - before_filter :build_new_custom_field, :only => [:new, :create] - before_filter :find_custom_field, :only => [:edit, :update, :destroy] + before_action :require_admin + before_action :build_new_custom_field, :only => [:new, :create] + before_action :find_custom_field, :only => [:edit, :update, :destroy] accept_api_auth :index def index diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 40db8af1e..e3cb6f1a4 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -18,10 +18,10 @@ class DocumentsController < ApplicationController default_search_scope :documents model_object Document - before_filter :find_project_by_project_id, :only => [:index, :new, :create] - before_filter :find_model_object, :except => [:index, :new, :create] - before_filter :find_project_from_association, :except => [:index, :new, :create] - before_filter :authorize + before_action :find_project_by_project_id, :only => [:index, :new, :create] + before_action :find_model_object, :except => [:index, :new, :create] + before_action :find_project_from_association, :except => [:index, :new, :create] + before_action :authorize helper :attachments helper :custom_fields diff --git a/app/controllers/email_addresses_controller.rb b/app/controllers/email_addresses_controller.rb index dfc80ad95..27c9fd22b 100644 --- a/app/controllers/email_addresses_controller.rb +++ b/app/controllers/email_addresses_controller.rb @@ -16,8 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class EmailAddressesController < ApplicationController - before_filter :find_user, :require_admin_or_current_user - before_filter :find_email_address, :only => [:update, :destroy] + before_action :find_user, :require_admin_or_current_user + before_action :find_email_address, :only => [:update, :destroy] require_sudo_mode :create, :update, :destroy def index diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index feb360398..905c67dda 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -18,10 +18,10 @@ class EnumerationsController < ApplicationController layout 'admin' - before_filter :require_admin, :except => :index - before_filter :require_admin_or_api_request, :only => :index - before_filter :build_new_enumeration, :only => [:new, :create] - before_filter :find_enumeration, :only => [:edit, :update, :destroy] + before_action :require_admin, :except => :index + before_action :require_admin_or_api_request, :only => :index + before_action :build_new_enumeration, :only => [:new, :create] + before_action :find_enumeration, :only => [:edit, :update, :destroy] accept_api_auth :index helper :custom_fields diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index db061b858..90a07cddc 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -18,8 +18,8 @@ class FilesController < ApplicationController menu_item :files - before_filter :find_project_by_project_id - before_filter :authorize + before_action :find_project_by_project_id + before_action :authorize helper :sort include SortHelper diff --git a/app/controllers/gantts_controller.rb b/app/controllers/gantts_controller.rb index e37d780dd..c9858bb9a 100644 --- a/app/controllers/gantts_controller.rb +++ b/app/controllers/gantts_controller.rb @@ -17,7 +17,7 @@ class GanttsController < ApplicationController menu_item :gantt - before_filter :find_optional_project + before_action :find_optional_project rescue_from Query::StatementInvalid, :with => :query_statement_invalid diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b99e374ff..8af3a8d61 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -18,8 +18,8 @@ class GroupsController < ApplicationController layout 'admin' - before_filter :require_admin - before_filter :find_group, :except => [:index, :new, :create] + before_action :require_admin + before_action :find_group, :except => [:index, :new, :create] accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user require_sudo_mode :add_users, :remove_user, :create, :update, :destroy, :edit_membership, :destroy_membership diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index cb5446c14..4c9f3e074 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -19,8 +19,8 @@ require 'csv' class ImportsController < ApplicationController - before_filter :find_import, :only => [:show, :settings, :mapping, :run] - before_filter :authorize_global + before_action :find_import, :only => [:show, :settings, :mapping, :run] + before_action :authorize_global helper :issues helper :queries diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index c53f2395d..b9ea10d9e 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -18,10 +18,10 @@ class IssueCategoriesController < ApplicationController menu_item :settings model_object IssueCategory - before_filter :find_model_object, :except => [:index, :new, :create] - before_filter :find_project_from_association, :except => [:index, :new, :create] - before_filter :find_project_by_project_id, :only => [:index, :new, :create] - before_filter :authorize + before_action :find_model_object, :except => [:index, :new, :create] + before_action :find_project_from_association, :except => [:index, :new, :create] + before_action :find_project_by_project_id, :only => [:index, :new, :create] + before_action :authorize accept_api_auth :index, :show, :create, :update, :destroy def index diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index 2e19cff68..70ec5b4a5 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -16,8 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueRelationsController < ApplicationController - before_filter :find_issue, :authorize, :only => [:index, :create] - before_filter :find_relation, :only => [:show, :destroy] + before_action :find_issue, :authorize, :only => [:index, :create] + before_action :find_relation, :only => [:show, :destroy] accept_api_auth :index, :show, :create, :destroy diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index e49878f1d..cac8c971e 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -18,8 +18,8 @@ class IssueStatusesController < ApplicationController layout 'admin' - before_filter :require_admin, :except => :index - before_filter :require_admin_or_api_request, :only => :index + before_action :require_admin, :except => :index + before_action :require_admin_or_api_request, :only => :index accept_api_auth :index def index diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 27bb4abf2..85b2c23a9 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -18,11 +18,11 @@ class IssuesController < ApplicationController default_search_scope :issues - before_filter :find_issue, :only => [:show, :edit, :update] - before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] - before_filter :authorize, :except => [:index, :new, :create] - before_filter :find_optional_project, :only => [:index, :new, :create] - before_filter :build_new_issue_from_params, :only => [:new, :create] + before_action :find_issue, :only => [:show, :edit, :update] + before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] + before_action :authorize, :except => [:index, :new, :create] + before_action :find_optional_project, :only => [:index, :new, :create] + before_action :build_new_issue_from_params, :only => [:new, :create] accept_rss_auth :index, :show accept_api_auth :index, :show, :create, :update, :destroy diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 00556c8e4..106c0692d 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -16,10 +16,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class JournalsController < ApplicationController - before_filter :find_journal, :only => [:edit, :update, :diff] - before_filter :find_issue, :only => [:new] - before_filter :find_optional_project, :only => [:index] - before_filter :authorize, :only => [:new, :edit, :update, :diff] + before_action :find_journal, :only => [:edit, :update, :diff] + before_action :find_issue, :only => [:new] + before_action :find_optional_project, :only => [:index] + before_action :authorize, :only => [:new, :edit, :update, :diff] accept_rss_auth :index menu_item :issues diff --git a/app/controllers/mail_handler_controller.rb b/app/controllers/mail_handler_controller.rb index ca08a2449..4949cc2d5 100644 --- a/app/controllers/mail_handler_controller.rb +++ b/app/controllers/mail_handler_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MailHandlerController < ActionController::Base - before_filter :check_credential + before_action :check_credential # Displays the email submission form def new diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 140d504aa..4aedf8f2d 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -17,10 +17,10 @@ class MembersController < ApplicationController model_object Member - before_filter :find_model_object, :except => [:index, :new, :create, :autocomplete] - before_filter :find_project_from_association, :except => [:index, :new, :create, :autocomplete] - before_filter :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete] - before_filter :authorize + before_action :find_model_object, :except => [:index, :new, :create, :autocomplete] + before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete] + before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete] + before_action :authorize accept_api_auth :index, :show, :create, :update, :destroy require_sudo_mode :create, :update, :destroy diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 487dcbe07..a06376851 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -18,10 +18,10 @@ class MessagesController < ApplicationController menu_item :boards default_search_scope :messages - before_filter :find_board, :only => [:new, :preview] - before_filter :find_attachments, :only => [:preview] - before_filter :find_message, :except => [:new, :preview] - before_filter :authorize, :except => [:preview, :edit, :destroy] + before_action :find_board, :only => [:new, :preview] + before_action :find_attachments, :only => [:preview] + before_action :find_message, :except => [:new, :preview] + before_action :authorize, :except => [:preview, :edit, :destroy] helper :boards helper :watchers diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 15ec0892a..2699f2cb0 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MyController < ApplicationController - before_filter :require_login + before_action :require_login # let user change user's password when user has to skip_before_filter :check_password_change, :only => :password diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 6e429e827..a97a158db 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -18,11 +18,11 @@ class NewsController < ApplicationController default_search_scope :news model_object News - before_filter :find_model_object, :except => [:new, :create, :index] - before_filter :find_project_from_association, :except => [:new, :create, :index] - before_filter :find_project_by_project_id, :only => [:new, :create] - before_filter :authorize, :except => [:index] - before_filter :find_optional_project, :only => :index + before_action :find_model_object, :except => [:new, :create, :index] + before_action :find_project_from_association, :except => [:new, :create, :index] + before_action :find_project_by_project_id, :only => [:new, :create] + before_action :authorize, :except => [:index] + before_action :find_optional_project, :only => :index accept_rss_auth :index accept_api_auth :index diff --git a/app/controllers/previews_controller.rb b/app/controllers/previews_controller.rb index 48828b199..698816e44 100644 --- a/app/controllers/previews_controller.rb +++ b/app/controllers/previews_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class PreviewsController < ApplicationController - before_filter :find_project, :find_attachments + before_action :find_project, :find_attachments def issue @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank? diff --git a/app/controllers/principal_memberships_controller.rb b/app/controllers/principal_memberships_controller.rb index 5cf8ff166..0ac150d71 100644 --- a/app/controllers/principal_memberships_controller.rb +++ b/app/controllers/principal_memberships_controller.rb @@ -18,9 +18,9 @@ class PrincipalMembershipsController < ApplicationController layout 'admin' - before_filter :require_admin - before_filter :find_principal, :only => [:new, :create] - before_filter :find_membership, :only => [:update, :destroy] + before_action :require_admin + before_action :find_principal, :only => [:new, :create] + before_action :find_membership, :only => [:update, :destroy] def new @projects = Project.active.all diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb index df3d8c2c4..f86a24a30 100644 --- a/app/controllers/project_enumerations_controller.rb +++ b/app/controllers/project_enumerations_controller.rb @@ -16,8 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class ProjectEnumerationsController < ApplicationController - before_filter :find_project_by_project_id - before_filter :authorize + before_action :find_project_by_project_id + before_action :authorize def update if params[:enumerations] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 15ab4c86e..07d664e5e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -19,10 +19,10 @@ class ProjectsController < ApplicationController menu_item :overview menu_item :settings, :only => :settings - before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] - before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] - before_filter :authorize_global, :only => [:new, :create] - before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] + before_action :find_project, :except => [ :index, :list, :new, :create, :copy ] + before_action :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] + before_action :authorize_global, :only => [:new, :create] + before_action :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy require_sudo_mode :destroy diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 84843c1dd..fda9d9711 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -17,8 +17,8 @@ class QueriesController < ApplicationController menu_item :issues - before_filter :find_query, :except => [:new, :create, :index] - before_filter :find_optional_project, :only => [:new, :create] + before_action :find_query, :except => [:new, :create, :index] + before_action :find_optional_project, :only => [:new, :create] accept_api_auth :index diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 20279871e..ef1bdc936 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -17,7 +17,7 @@ class ReportsController < ApplicationController menu_item :issues - before_filter :find_project, :authorize, :find_issue_statuses + before_action :find_project, :authorize, :find_issue_statuses def issue_report @trackers = @project.rolled_up_trackers(false).visible diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index c963ee00f..abb1aabdb 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -28,11 +28,11 @@ class RepositoriesController < ApplicationController menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers] default_search_scope :changesets - before_filter :find_project_by_project_id, :only => [:new, :create] - before_filter :find_repository, :only => [:edit, :update, :destroy, :committers] - before_filter :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers] - before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] - before_filter :authorize + before_action :find_project_by_project_id, :only => [:new, :create] + before_action :find_repository, :only => [:edit, :update, :destroy, :committers] + before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers] + before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] + before_action :authorize accept_rss_auth :revisions rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 2de185b5b..20d19d8af 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -18,9 +18,9 @@ class RolesController < ApplicationController layout 'admin' - before_filter :require_admin, :except => [:index, :show] - before_filter :require_admin_or_api_request, :only => [:index, :show] - before_filter :find_role, :only => [:show, :edit, :update, :destroy] + before_action :require_admin, :except => [:index, :show] + before_action :require_admin_or_api_request, :only => [:index, :show] + before_action :find_role, :only => [:show, :edit, :update, :destroy] accept_api_auth :index, :show require_sudo_mode :create, :update, :destroy diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index cc1970ef1..4b35cd8b4 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class SearchController < ApplicationController - before_filter :find_optional_project + before_action :find_optional_project accept_api_auth :index def index diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 9552efb9b..dfbf3fc1e 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -21,7 +21,7 @@ class SettingsController < ApplicationController helper :queries - before_filter :require_admin + before_action :require_admin require_sudo_mode :index, :edit, :plugin diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index 9231153b6..495cbcf64 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class SysController < ActionController::Base - before_filter :check_enabled + before_action :check_enabled def projects p = Project.active.has_module(:repository). diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 30560dcfb..f293855a5 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -18,13 +18,13 @@ class TimelogController < ApplicationController menu_item :issues - before_filter :find_time_entry, :only => [:show, :edit, :update] - before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] - before_filter :authorize, :only => [:show, :edit, :update, :bulk_edit, :bulk_update, :destroy] + before_action :find_time_entry, :only => [:show, :edit, :update] + before_action :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] + before_action :authorize, :only => [:show, :edit, :update, :bulk_edit, :bulk_update, :destroy] - before_filter :find_optional_issue, :only => [:new, :create] - before_filter :find_optional_project, :only => [:index, :report] - before_filter :authorize_global, :only => [:new, :create, :index, :report] + before_action :find_optional_issue, :only => [:new, :create] + before_action :find_optional_project, :only => [:index, :report] + before_action :authorize_global, :only => [:new, :create, :index, :report] accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 2b93753d0..49856e352 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -18,8 +18,8 @@ class TrackersController < ApplicationController layout 'admin' - before_filter :require_admin, :except => :index - before_filter :require_admin_or_api_request, :only => :index + before_action :require_admin, :except => :index + before_action :require_admin_or_api_request, :only => :index accept_api_auth :index def index diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5a7256d76..03458ba47 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -18,8 +18,8 @@ class UsersController < ApplicationController layout 'admin' - before_filter :require_admin, :except => :show - before_filter :find_user, :only => [:show, :edit, :update, :destroy] + before_action :require_admin, :except => :show + before_action :find_user, :only => [:show, :edit, :update, :destroy] accept_api_auth :index, :show, :create, :update, :destroy helper :sort diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index e1684e3cf..84c7980eb 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -18,10 +18,10 @@ class VersionsController < ApplicationController menu_item :roadmap model_object Version - before_filter :find_model_object, :except => [:index, :new, :create, :close_completed] - before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed] - before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed] - before_filter :authorize + before_action :find_model_object, :except => [:index, :new, :create, :close_completed] + before_action :find_project_from_association, :except => [:index, :new, :create, :close_completed] + before_action :find_project_by_project_id, :only => [:index, :new, :create, :close_completed] + before_action :authorize accept_api_auth :index, :show, :create, :update, :destroy diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index d9f2351d0..818ed3597 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WatchersController < ApplicationController - before_filter :require_login, :find_watchables, :only => [:watch, :unwatch] + before_action :require_login, :find_watchables, :only => [:watch, :unwatch] def watch set_watcher(@watchables, User.current, true) @@ -26,7 +26,7 @@ class WatchersController < ApplicationController set_watcher(@watchables, User.current, false) end - before_filter :find_project, :authorize, :only => [:new, :create, :append, :destroy, :autocomplete_for_user] + before_action :find_project, :authorize, :only => [:new, :create, :append, :destroy, :autocomplete_for_user] accept_api_auth :create, :destroy def new diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 10fd099e0..de1931a0b 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -31,11 +31,11 @@ # TODO: still being worked on class WikiController < ApplicationController default_search_scope :wiki_pages - before_filter :find_wiki, :authorize - before_filter :find_existing_or_new_page, :only => [:show, :edit, :update] - before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy, :destroy_version] + before_action :find_wiki, :authorize + before_action :find_existing_or_new_page, :only => [:show, :edit, :update] + before_action :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy, :destroy_version] + before_action :find_attachments, :only => [:preview] accept_api_auth :index, :show, :update, :destroy - before_filter :find_attachments, :only => [:preview] helper :attachments include AttachmentsHelper diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index 61abfaf65..fe3370863 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -17,7 +17,7 @@ class WikisController < ApplicationController menu_item :settings - before_filter :find_project, :authorize + before_action :find_project, :authorize # Create or update a project's wiki def edit diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index 7f92f2546..9fc376725 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -18,7 +18,7 @@ class WorkflowsController < ApplicationController layout 'admin' - before_filter :require_admin + before_action :require_admin def index @roles = Role.sorted.select(&:consider_workflow?) diff --git a/extra/sample_plugin/app/controllers/example_controller.rb b/extra/sample_plugin/app/controllers/example_controller.rb index dbc271a1b..b85599a37 100644 --- a/extra/sample_plugin/app/controllers/example_controller.rb +++ b/extra/sample_plugin/app/controllers/example_controller.rb @@ -3,7 +3,7 @@ class ExampleController < ApplicationController unloadable layout 'base' - before_filter :find_project, :authorize + before_action :find_project, :authorize menu_item :sample_plugin def say_hello diff --git a/lib/redmine/sudo_mode.rb b/lib/redmine/sudo_mode.rb index 3f2749cd5..6d3ac6878 100644 --- a/lib/redmine/sudo_mode.rb +++ b/lib/redmine/sudo_mode.rb @@ -108,7 +108,7 @@ module Redmine @sudo_form ||= SudoMode::Form.new @sudo_form.original_fields = params.slice( *param_names ) # a simple 'render "sudo_mode/new"' works when used directly inside an - # action, but not when called from a before_filter: + # action, but not when called from a before_action: respond_to do |format| format.html { render 'sudo_mode/new' } format.js { render 'sudo_mode/new' } @@ -168,7 +168,7 @@ module Redmine actions = args.dup options = actions.extract_options! filter = SudoRequestFilter.new Array(options[:parameters]), Array(options[:only]) - before_filter filter, only: actions + before_action filter, only: actions end end end