diff --git a/.rubocop.yml b/.rubocop.yml index 03b78d6884016d3cca875d16414e521914703a73..0cc729d3b08eff154b191a719e982b6ed3ccd2bc 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -954,7 +954,7 @@ Lint/Void: Rails/ActionFilter: Description: 'Enforces consistent use of action filter methods.' - Enabled: false + Enabled: true Rails/DefaultScope: Description: 'Checks if the argument passed to default_scope is a block.' diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 6a8f20f60471fe3722bf630077b07ec5b6cf02e8..fe5456f820caec82e5060fb4e841dade4860e957 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -3,7 +3,7 @@ # Automatically sets the layout and ensures an administrator is logged in class Admin::ApplicationController < ApplicationController layout 'admin' - before_filter :authenticate_admin! + before_action :authenticate_admin! def authenticate_admin! return render_404 unless current_user.is_admin? diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index b5fda196bf0e89ea4d2e5a1f5faf1273cc9bac5b..e97576769086742d6548e0f76f1243d2b0940a01 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -1,5 +1,5 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController - before_filter :set_application_setting + before_action :set_application_setting def show end diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index e1643bb34bf7ce3ab8a3e5f3041ce68d2b9009cb..0808024fc39a46b39f49c298f7983a0080f39e6c 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -1,5 +1,5 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController - before_filter :broadcast_messages + before_action :broadcast_messages def index @broadcast_message = BroadcastMessage.new diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb index e93603bef362f304dda135f3021f725aa54e55f0..c301e61d1c7ab0cf2d7cc4d53e91857c64c05b85 100644 --- a/app/controllers/admin/deploy_keys_controller.rb +++ b/app/controllers/admin/deploy_keys_controller.rb @@ -1,13 +1,13 @@ class Admin::DeployKeysController < Admin::ApplicationController - before_filter :deploy_keys, only: [:index] - before_filter :deploy_key, only: [:show, :destroy] + before_action :deploy_keys, only: [:index] + before_action :deploy_key, only: [:show, :destroy] def index end def show - + end def new diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 22d045fc388a07332a29c155da38a6e5b401f881..2dfae13ac5c0e10f980fa78668b6aa5143df2ad1 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,5 +1,5 @@ class Admin::GroupsController < Admin::ApplicationController - before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update] + before_action :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update] def index @groups = Group.all diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb index 21111bb44f5aa9cb5c3f3e0f8b7516a7e78272a7..cb33fdd97634158bb037ba10f6c360c73c2c9ade 100644 --- a/app/controllers/admin/keys_controller.rb +++ b/app/controllers/admin/keys_controller.rb @@ -1,5 +1,5 @@ class Admin::KeysController < Admin::ApplicationController - before_filter :user, only: [:show, :destroy] + before_action :user, only: [:show, :destroy] def show @key = user.keys.find(params[:id]) diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 5176a8399ae63b74ead7232cc94b6dca7d6df449..ee449badf59a2a51084d7421e1919f6cb4159ff4 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,7 +1,7 @@ class Admin::ProjectsController < Admin::ApplicationController - before_filter :project, only: [:show, :transfer] - before_filter :group, only: [:show, :transfer] - before_filter :repository, only: [:show, :transfer] + before_action :project, only: [:show, :transfer] + before_action :group, only: [:show, :transfer] + before_action :repository, only: [:show, :transfer] def index @projects = Project.all diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index 76a938c5fe4fd8587c4a75659946dad255edfe2b..c1fdcd7fab66ef698154f668b731792276e7cbda 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -1,5 +1,5 @@ class Admin::ServicesController < Admin::ApplicationController - before_filter :service, only: [:edit, :update] + before_action :service, only: [:edit, :update] def index @services = services_templates diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index b4c011f213c1bd3507f5940ed2f146301322f104..adb83996f8bf6513e980d6d9e588ff3987c92b44 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,5 +1,5 @@ class Admin::UsersController < Admin::ApplicationController - before_filter :user, only: [:show, :edit, :update, :destroy] + before_action :user, only: [:show, :edit, :update, :destroy] def index @users = User.order_name_asc.filter(params[:filter]) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 920a981e7c9bc3501f241fc6cdc262128378737e..8ddb424dcfbc9e40fa0c840d5013c4b0010d506b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,15 +6,15 @@ class ApplicationController < ActionController::Base PER_PAGE = 20 - before_filter :authenticate_user_from_token! - before_filter :authenticate_user! - before_filter :reject_blocked! - before_filter :check_password_expiration - before_filter :ldap_security_check - before_filter :default_headers - before_filter :add_gon_variables - before_filter :configure_permitted_parameters, if: :devise_controller? - before_filter :require_email, unless: :devise_controller? + before_action :authenticate_user_from_token! + before_action :authenticate_user! + before_action :reject_blocked! + before_action :check_password_expiration + before_action :ldap_security_check + before_action :default_headers + before_action :add_gon_variables + before_action :configure_permitted_parameters, if: :devise_controller? + before_action :require_email, unless: :devise_controller? protect_from_forgery with: :exception diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb index cb51792df16f223fce050bcaf3ff170a62520cb6..33227e7f1d8bc6ec1e8e3d352a5310b685ce4814 100644 --- a/app/controllers/dashboard/milestones_controller.rb +++ b/app/controllers/dashboard/milestones_controller.rb @@ -1,5 +1,5 @@ class Dashboard::MilestonesController < ApplicationController - before_filter :load_projects + before_action :load_projects def index project_milestones = case params[:state] diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 56e6fcc41ca1445c54150b4f9653968d5091c166..426bc6154153053a82ffa0e54a59e1a22c34c3ac 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -1,5 +1,5 @@ class Dashboard::ProjectsController < ApplicationController - before_filter :event_filter + before_action :event_filter def starred @projects = current_user.starred_projects diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 9bd853ed5c70ef751c6cf40b6144ed3c77937e59..40b5de1295a0447005f585e5bc19c9d4bbc37f75 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,8 +1,8 @@ class DashboardController < ApplicationController respond_to :html - before_filter :load_projects, except: [:projects] - before_filter :event_filter, only: :show + before_action :load_projects, except: [:projects] + before_action :event_filter, only: :show def show @projects = @projects.includes(:namespace) diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb index c51a4a211a6210688350602240c8f6f5c5a744d1..a7250b799f352141d412f47efe062dd0d2a4fb6a 100644 --- a/app/controllers/explore/groups_controller.rb +++ b/app/controllers/explore/groups_controller.rb @@ -1,5 +1,5 @@ class Explore::GroupsController < ApplicationController - skip_before_filter :authenticate_user!, + skip_before_action :authenticate_user!, :reject_blocked, :set_current_user_for_observers layout "explore" diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index b295f295bb10fbf0e1798a17af79500c4279f7ec..b1b0a2514dc0858ff30ffcb74dd10ec1e2e6232f 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -1,5 +1,5 @@ class Explore::ProjectsController < ApplicationController - skip_before_filter :authenticate_user!, + skip_before_action :authenticate_user!, :reject_blocked layout 'explore' diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 265cf4f0f4a13544fa5abbec2f6398472bab068a..5648a652e8e8a5da4e4f0c8891695c0e48e1077a 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -1,10 +1,10 @@ class Groups::GroupMembersController < Groups::ApplicationController - skip_before_filter :authenticate_user!, only: [:index] - before_filter :group + skip_before_action :authenticate_user!, only: [:index] + before_action :group # Authorize - before_filter :authorize_read_group! - before_filter :authorize_admin_group!, except: [:index, :leave] + before_action :authorize_read_group! + before_action :authorize_admin_group!, except: [:index, :leave] layout :determine_layout @@ -49,7 +49,7 @@ class Groups::GroupMembersController < Groups::ApplicationController def resend_invite redirect_path = group_group_members_path(@group) - + @group_member = @group.group_members.find(params[:id]) if @group_member.invite? @@ -63,7 +63,7 @@ class Groups::GroupMembersController < Groups::ApplicationController def leave @group_member = @group.group_members.where(user_id: current_user.id).first - + if can?(current_user, :destroy_group_member, @group_member) @group_member.destroy redirect_to(dashboard_groups_path, notice: "You left #{group.name} group.") diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 546ff2cc71fd26007473436b242e203b57858e09..41564b04a92482bd297e042d4e9029daf8aab23a 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -1,7 +1,7 @@ class Groups::MilestonesController < ApplicationController layout 'group' - before_filter :authorize_group_milestone!, only: :update + before_action :authorize_group_milestone!, only: :update def index project_milestones = case params[:state] diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 7af3c077182228637d1691653336fcc6ea4f5caf..294af0b170450ef6a198a0b11e00bf4bd4813aed 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,17 +1,17 @@ class GroupsController < Groups::ApplicationController - skip_before_filter :authenticate_user!, only: [:show, :issues, :merge_requests] + skip_before_action :authenticate_user!, only: [:show, :issues, :merge_requests] respond_to :html - before_filter :group, except: [:new, :create] + before_action :group, except: [:new, :create] # Authorize - before_filter :authorize_read_group!, except: [:new, :create] - before_filter :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] - before_filter :authorize_create_group!, only: [:new, :create] + before_action :authorize_read_group!, except: [:new, :create] + before_action :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] + before_action :authorize_create_group!, only: [:new, :create] # Load group projects - before_filter :load_projects, except: [:new, :create, :projects, :edit, :update] - before_filter :event_filter, only: :show - before_filter :set_title, only: [:new, :create] + before_action :load_projects, except: [:new, :create, :projects, :edit, :update] + before_action :event_filter, only: :show + before_action :set_title, only: [:new, :create] layout :determine_layout diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index bb8d7e0235c69c253220845d9a45f1f3ae1f05bc..ca78a4aaa8e5e4705b12994c31304b8c6439e165 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -1,15 +1,15 @@ class Import::BitbucketController < Import::BaseController - before_filter :verify_bitbucket_import_enabled - before_filter :bitbucket_auth, except: :callback + before_action :verify_bitbucket_import_enabled + before_action :bitbucket_auth, except: :callback rescue_from OAuth::Error, with: :bitbucket_unauthorized def callback - request_token = session.delete(:oauth_request_token) + request_token = session.delete(:oauth_request_token) raise "Session expired!" if request_token.nil? request_token.symbolize_keys! - + access_token = client.get_token(request_token, params[:oauth_verifier], callback_import_bitbucket_url) current_user.bitbucket_access_token = access_token.token @@ -21,7 +21,7 @@ class Import::BitbucketController < Import::BaseController def status @repos = client.projects - + @already_added_projects = current_user.created_projects.where(import_type: "bitbucket") already_added_projects_names = @already_added_projects.pluck(:import_source) @@ -41,7 +41,7 @@ class Import::BitbucketController < Import::BaseController repo_owner = repo["owner"] repo_owner = current_user.username if repo_owner == client.user["user"]["username"] @target_namespace = params[:new_namespace].presence || repo_owner - + namespace = get_or_create_namespace || (render and return) unless Gitlab::BitbucketImport::KeyAdder.new(repo, current_user).execute diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index 87b41454c778e965b60ff3c7ddb399db0f33b9d2..b9f99c1b88ad75f46f74772bd1dc7bcf0e0effb5 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -1,6 +1,6 @@ class Import::GithubController < Import::BaseController - before_filter :verify_github_import_enabled - before_filter :github_auth, except: :callback + before_action :verify_github_import_enabled + before_action :github_auth, except: :callback rescue_from Octokit::Unauthorized, with: :github_unauthorized @@ -36,7 +36,7 @@ class Import::GithubController < Import::BaseController repo_owner = repo.owner.login repo_owner = current_user.username if repo_owner == client.user.login @target_namespace = params[:new_namespace].presence || repo_owner - + namespace = get_or_create_namespace || (render and return) @project = Gitlab::GithubImport::ProjectCreator.new(repo, namespace, current_user).execute diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb index bddbfded81246e8cc6bfbb02b4764b81ccead695..1b8962d89244b223b87a7de46e7e34e0a8f4d774 100644 --- a/app/controllers/import/gitlab_controller.rb +++ b/app/controllers/import/gitlab_controller.rb @@ -1,6 +1,6 @@ class Import::GitlabController < Import::BaseController - before_filter :verify_gitlab_import_enabled - before_filter :gitlab_auth, except: :callback + before_action :verify_gitlab_import_enabled + before_action :gitlab_auth, except: :callback rescue_from OAuth2::Error, with: :gitlab_unauthorized @@ -13,7 +13,7 @@ class Import::GitlabController < Import::BaseController def status @repos = client.projects - + @already_added_projects = current_user.created_projects.where(import_type: "gitlab") already_added_projects_names = @already_added_projects.pluck(:import_source) @@ -33,7 +33,7 @@ class Import::GitlabController < Import::BaseController repo_owner = repo["namespace"]["path"] repo_owner = current_user.username if repo_owner == client.user["username"] @target_namespace = params[:new_namespace].presence || repo_owner - + namespace = get_or_create_namespace || (render and return) @project = Gitlab::GitlabImport::ProjectCreator.new(repo, namespace, current_user).execute diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index 73c912e285bf86193e982c9cb23a9351322d7daf..8a9ff652263b492709aeaa94514d967d50e21ff4 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -1,8 +1,8 @@ class Import::GoogleCodeController < Import::BaseController - before_filter :user_map, only: [:new_user_map, :create_user_map] + before_action :user_map, only: [:new_user_map, :create_user_map] def new - + end def callback @@ -68,7 +68,7 @@ class Import::GoogleCodeController < Import::BaseController def status unless client.valid? - return redirect_to new_import_google_path + return redirect_to new_import_google_path end @repos = client.repos diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 1f97ff16c5519a33086fe82120af3a298843c80b..a29c03395f42ca43a94cf61d7a473efc32500c87 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -1,6 +1,6 @@ class InvitesController < ApplicationController - before_filter :member - skip_before_filter :authenticate_user!, only: :decline + before_action :member + skip_before_action :authenticate_user!, only: :decline respond_to :html @@ -24,7 +24,7 @@ class InvitesController < ApplicationController if member.decline_invite! label, _ = source_info(member.source) - path = + path = if current_user dashboard_path else @@ -41,7 +41,7 @@ class InvitesController < ApplicationController def member return @member if defined?(@member) - + @token = params[:id] @member = Member.find_by_invite_token(@token) diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb index 386d103ee5a629a046d5127c34751dfff00b388b..83eec1bf4a2645ea9aa5987ca9379681b52e6b4b 100644 --- a/app/controllers/namespaces_controller.rb +++ b/app/controllers/namespaces_controller.rb @@ -1,5 +1,5 @@ class NamespacesController < ApplicationController - skip_before_filter :authenticate_user! + skip_before_action :authenticate_user! def show namespace = Namespace.find_by(path: params[:id]) diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index efa291d9397559f5e9c1eb1e3f0f388a51b4daa3..ea256de2c3e53ce6f59b4745fb29a906ef27d97f 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -1,5 +1,5 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController - before_filter :authenticate_user! + before_action :authenticate_user! layout "profile" def index @@ -10,7 +10,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController @application = Doorkeeper::Application.new(application_params) @application.owner = current_user - + if @application.save flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) redirect_to oauth_application_url(@application) diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index a57b4a60c24824950f14f8b2f74fe4d479c3b549..6d3c1a320db1d0ca1ee30e86ada197c4c8c89ff9 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -1,5 +1,5 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController - before_filter :authenticate_resource_owner! + before_action :authenticate_resource_owner! layout "profile" def new diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index 4e2bd0a9b4b92c9730f6ec9522a8e2f1e6f992b3..b0a5a631c63e3282a4aed088b7ad2749a7ad7581 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -1,6 +1,6 @@ class Profiles::KeysController < ApplicationController layout "profile" - skip_before_filter :authenticate_user!, only: [:get_keys] + skip_before_action :authenticate_user!, only: [:get_keys] def index @keys = current_user.keys diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb index 0c614969a3fe8626cad43d97bece80f869dd2fb1..b719a7fe9a9ca495c522542243ce653fb2056637 100644 --- a/app/controllers/profiles/passwords_controller.rb +++ b/app/controllers/profiles/passwords_controller.rb @@ -1,11 +1,11 @@ class Profiles::PasswordsController < ApplicationController layout :determine_layout - skip_before_filter :check_password_expiration, only: [:new, :create] + skip_before_action :check_password_expiration, only: [:new, :create] - before_filter :set_user - before_filter :set_title - before_filter :authorize_change_password! + before_action :set_user + before_action :set_title + before_action :authorize_change_password! def new end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 7f76906066d2015b096f2190ed8b35c920dc419d..eb001e8d73955ed5b8028e06e34cc3c5b74b06e5 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,9 +1,9 @@ class ProfilesController < ApplicationController include ActionView::Helpers::SanitizeHelper - before_filter :user - before_filter :authorize_change_username!, only: :update_username - skip_before_filter :require_email, only: [:show, :update] + before_action :user + before_action :authorize_change_username!, only: :update_username + skip_before_action :require_email, only: [:show, :update] layout 'profile' diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 4719933394fca0ef749385e01a1a2bff8c435831..f7a28e920d190d139444d713509e04396ff4af85 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -1,6 +1,6 @@ class Projects::ApplicationController < ApplicationController - before_filter :project - before_filter :repository + before_action :project + before_action :repository layout :determine_layout def authenticate_user! diff --git a/app/controllers/projects/avatars_controller.rb b/app/controllers/projects/avatars_controller.rb index a482b90880da9fdf0e935a4d34d657777551732a..22a12c4b9ae025e4d4d2f6ebd495e3648095c0f3 100644 --- a/app/controllers/projects/avatars_controller.rb +++ b/app/controllers/projects/avatars_controller.rb @@ -1,7 +1,7 @@ class Projects::AvatarsController < Projects::ApplicationController layout 'project' - before_filter :project + before_action :project def show @blob = @project.repository.blob_at_branch('master', @project.avatar_in_git) diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb index a87b8270a22eb37a365f285662897d6cb8885b84..3362264dccee2f940f3a72c37580d1b0b68e4d4e 100644 --- a/app/controllers/projects/blame_controller.rb +++ b/app/controllers/projects/blame_controller.rb @@ -2,9 +2,9 @@ class Projects::BlameController < Projects::ApplicationController include ExtractsPath - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :assign_ref_vars + before_action :authorize_download_code! def show @blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path) diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 4b7eb4df298ee50c84d315a279dbd20a1c5b0c9b..b762518d377fb5dc2ab6670b53f8d3513b4a6e56 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -6,15 +6,15 @@ class Projects::BlobController < Projects::ApplicationController # Raised when given an invalid file path class InvalidPathError < StandardError; end - before_filter :require_non_empty_project, except: [:new, :create] - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:destroy] - before_filter :assign_blob_vars - before_filter :commit, except: [:new, :create] - before_filter :blob, except: [:new, :create] - before_filter :from_merge_request, only: [:edit, :update] - before_filter :after_edit_path, only: [:edit, :update] - before_filter :require_branch_head, only: [:edit, :update] + before_action :require_non_empty_project, except: [:new, :create] + before_action :authorize_download_code! + before_action :authorize_push_code!, only: [:destroy] + before_action :assign_blob_vars + before_action :commit, except: [:new, :create] + before_action :blob, except: [:new, :create] + before_action :from_merge_request, only: [:edit, :update] + before_action :after_edit_path, only: [:edit, :update] + before_action :require_branch_head, only: [:edit, :update] def new commit unless @repository.empty? diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index f049e96e61df4fcee5ed91daf7f24c60aeb8a798..696011b94b9bb23d7d563ac85736f20d15f62480 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -1,9 +1,9 @@ class Projects::BranchesController < Projects::ApplicationController include ActionView::Helpers::SanitizeHelper # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:create, :destroy] + before_action :require_non_empty_project + before_action :authorize_download_code! + before_action :authorize_push_code!, only: [:create, :destroy] def index @sort = params[:sort] || 'name' diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 894cf93b9ae7c624aa5cb2c6ca05f81bc80ddee2..8a1b7899be3d0172aeb088de81f8b7f71ef21e45 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -3,9 +3,9 @@ # Not to be confused with CommitsController, plural. class Projects::CommitController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :commit + before_action :require_non_empty_project + before_action :authorize_download_code! + before_action :commit def show return git_not_found! unless @commit diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb index 4b6ab43747625eb2dc91501b37bc7c51bd98e7e7..d1c15174aea8ead1d12e15302fc17f04bbae3693 100644 --- a/app/controllers/projects/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -3,9 +3,9 @@ require "base64" class Projects::CommitsController < Projects::ApplicationController include ExtractsPath - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :assign_ref_vars + before_action :authorize_download_code! def show @repo = @project.repository diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 146808fa5620c93b9bbb6c85949393ccbbfc51b0..03e6c381275b4d4fefa6f09786325103718a18f9 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -1,7 +1,7 @@ class Projects::CompareController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :authorize_download_code! def index end diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index 6fba3ce299bf119ab808331105181e3e12e2fb74..8c1bbf76917f17b3e11ad11cbf1697f50d0ff650 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -2,7 +2,7 @@ class Projects::DeployKeysController < Projects::ApplicationController respond_to :html # Authorize - before_filter :authorize_admin_project! + before_action :authorize_admin_project! layout "project_settings" diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index 21a151a426e57fe3295f40061123ad63ee04f6a1..01a079d2e6593d9a3bdb6e05d5d9bd3778d655e7 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -1,7 +1,7 @@ class Projects::ForksController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :authorize_download_code! def new @namespaces = current_user.manageable_namespaces diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb index 6e54af356e0c96c8e1d60b9e62b0060baf6e4efc..a060ea6f9989d448fd8e48d05d05cf5a69a2f8e2 100644 --- a/app/controllers/projects/graphs_controller.rb +++ b/app/controllers/projects/graphs_controller.rb @@ -1,7 +1,7 @@ class Projects::GraphsController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :authorize_download_code! def show respond_to do |format| diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index ba95bb13e1fbae73408a512da0948705f61c073a..57fc48ac7da5ab5523b8a80b775cd56387e6a5c1 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -1,6 +1,6 @@ class Projects::HooksController < Projects::ApplicationController # Authorize - before_filter :authorize_admin_project! + before_action :authorize_admin_project! respond_to :html diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index b64491b4666b9a18cd30a24aaea42d99ed8c2893..066b66014f8725ce6c7dd50db8d472d4208e1957 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -1,8 +1,8 @@ class Projects::ImportsController < Projects::ApplicationController # Authorize - before_filter :authorize_admin_project! - before_filter :require_no_repo - before_filter :redirect_if_progress, except: :show + before_action :authorize_admin_project! + before_action :require_no_repo + before_action :redirect_if_progress, except: :show def new end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 88302276b5ee59974886c60a40ea47d74cdbe770..c524e1a0ea306477469d88ccecdc8f0e270fcb49 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -1,18 +1,18 @@ class Projects::IssuesController < Projects::ApplicationController - before_filter :module_enabled - before_filter :issue, only: [:edit, :update, :show, :toggle_subscription] + before_action :module_enabled + before_action :issue, only: [:edit, :update, :show, :toggle_subscription] # Allow read any issue - before_filter :authorize_read_issue! + before_action :authorize_read_issue! # Allow write(create) issue - before_filter :authorize_write_issue!, only: [:new, :create] + before_action :authorize_write_issue!, only: [:new, :create] # Allow modify issue - before_filter :authorize_modify_issue!, only: [:edit, :update] + before_action :authorize_modify_issue!, only: [:edit, :update] # Allow issues bulk update - before_filter :authorize_admin_issues!, only: [:bulk_update] + before_action :authorize_admin_issues!, only: [:bulk_update] respond_to :html @@ -99,7 +99,7 @@ class Projects::IssuesController < Projects::ApplicationController def toggle_subscription @issue.toggle_subscription(current_user) - + render nothing: true end diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 207a01ed3b0ef6c82669fc3055397af307d69394..2f8cb203cf9e77259c9cec78d5ab4ea50e6cb026 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -1,8 +1,8 @@ class Projects::LabelsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :label, only: [:edit, :update, :destroy] - before_filter :authorize_labels! - before_filter :authorize_admin_labels!, except: [:index] + before_action :module_enabled + before_action :label, only: [:edit, :update, :destroy] + before_action :authorize_labels! + before_action :authorize_admin_labels!, except: [:index] respond_to :js, :html diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 47ce8467358b4c72804fe8ca71b79c7c28d84fac..ab75f2ddb7351f5dd22007de9e6787134d24dcd2 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -1,20 +1,20 @@ require 'gitlab/satellite/satellite' class Projects::MergeRequestsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status, :toggle_subscription] - before_filter :closes_issues, only: [:edit, :update, :show, :diffs] - before_filter :validates_merge_request, only: [:show, :diffs] - before_filter :define_show_vars, only: [:show, :diffs] + before_action :module_enabled + before_action :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status, :toggle_subscription] + before_action :closes_issues, only: [:edit, :update, :show, :diffs] + before_action :validates_merge_request, only: [:show, :diffs] + before_action :define_show_vars, only: [:show, :diffs] # Allow read any merge_request - before_filter :authorize_read_merge_request! + before_action :authorize_read_merge_request! # Allow write(create) merge_request - before_filter :authorize_write_merge_request!, only: [:new, :create] + before_action :authorize_write_merge_request!, only: [:new, :create] # Allow modify merge_request - before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] + before_action :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] def index terms = params['issue_search'] @@ -176,7 +176,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController def toggle_subscription @merge_request.toggle_subscription(current_user) - + render nothing: true end diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index b49b549547ab149278935b942996f79eeacebaca..61689488d13b24961453086462a414c13b16c0bf 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -1,12 +1,12 @@ class Projects::MilestonesController < Projects::ApplicationController - before_filter :module_enabled - before_filter :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests] + before_action :module_enabled + before_action :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests] # Allow read any milestone - before_filter :authorize_read_milestone! + before_action :authorize_read_milestone! # Allow admin milestone - before_filter :authorize_admin_milestone!, except: [:index, :show] + before_action :authorize_admin_milestone!, except: [:index, :show] respond_to :html diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb index 83d1c1dacae6d5c4afa83ef10bdf520c95c76d21..06aef91cadd6bcb497204a6295330ef13dfdc358 100644 --- a/app/controllers/projects/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -2,9 +2,9 @@ class Projects::NetworkController < Projects::ApplicationController include ExtractsPath include ApplicationHelper - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :assign_ref_vars + before_action :authorize_download_code! def show respond_to do |format| diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 868629a0bc4aee1f33e7e55cc154dda8efe4217c..496b85cb46de02f26bc192cf1ce4d7dadd8b2b2c 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -1,9 +1,9 @@ class Projects::NotesController < Projects::ApplicationController # Authorize - before_filter :authorize_read_note! - before_filter :authorize_write_note!, only: [:create] - before_filter :authorize_admin_note!, only: [:update, :destroy] - before_filter :find_current_user_notes, except: [:destroy, :delete_attachment] + before_action :authorize_read_note! + before_action :authorize_write_note!, only: [:create] + before_action :authorize_admin_note!, only: [:update, :destroy] + before_action :find_current_user_notes, except: [:destroy, :delete_attachment] def index current_fetched_at = Time.now.to_i diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 72967a26ff12c6fe40f8451d1cb55ddc8e026f4c..d7fbc979067790c7265c4a092efcd3bed7128f03 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -1,6 +1,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController # Authorize - before_filter :authorize_admin_project!, except: :leave + before_action :authorize_admin_project!, except: :leave layout "project_settings" @@ -24,7 +24,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController users = @group.users.search(params[:search]).to_a @group_members = @group_members.where(user_id: users) end - + @group_members = @group_members.order('access_level DESC').limit(20) end @@ -62,7 +62,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController redirect_path = namespace_project_project_members_path(@project.namespace, @project) @project_member = @project.project_members.find(params[:id]) - + if @project_member.invite? @project_member.resend_invite diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb index ac36ac6fcd3902470c175f6310132f53856f25dd..6b52eccebf73a6f49406052ad28994b82324a39c 100644 --- a/app/controllers/projects/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -1,7 +1,7 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_admin_project! + before_action :require_non_empty_project + before_action :authorize_admin_project! layout "project_settings" diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index b1a029ce69618c432c75ee6585d38c5242eb13d0..647c145407827101daa20d52a3c5bd8fa3346d94 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -2,9 +2,9 @@ class Projects::RawController < Projects::ApplicationController include ExtractsPath - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :assign_ref_vars + before_action :authorize_download_code! def show @blob = @repository.blob_at(@commit.id, @path) diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index ec3b2b8d75a56d8d125555d5ed7fb373a8beb348..01ca1537c0e66316229fa9df52f7bed145d19b20 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -1,9 +1,9 @@ class Projects::RefsController < Projects::ApplicationController include ExtractsPath - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project + before_action :assign_ref_vars + before_action :authorize_download_code! def switch respond_to do |format| diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index 96defb0c721c52837a77a45a434e849ace335b06..c4a5e2d63598f624c6a7990cb64913cd65cc769e 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -1,8 +1,8 @@ class Projects::RepositoriesController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project, except: :create - before_filter :authorize_download_code! - before_filter :authorize_admin_project!, only: :create + before_action :require_non_empty_project, except: :create + before_action :authorize_download_code! + before_action :authorize_admin_project!, only: :create def create @project.create_repository diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 9a484c109baf9d449f5cbdf88ea9ec3240927eb0..ae8146dca590b94b883c1c0bc5d39b46d8acd8a2 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -1,7 +1,7 @@ class Projects::ServicesController < Projects::ApplicationController # Authorize - before_filter :authorize_admin_project! - before_filter :service, only: [:edit, :update, :test] + before_action :authorize_admin_project! + before_action :service, only: [:edit, :update, :test] respond_to :html diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index ed26840037360227877ddaa92fc275520f00ede8..3d75abcc29d5171912058796b0d93c0e66561288 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -1,18 +1,18 @@ class Projects::SnippetsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] + before_action :module_enabled + before_action :snippet, only: [:show, :edit, :destroy, :update, :raw] # Allow read any snippet - before_filter :authorize_read_project_snippet! + before_action :authorize_read_project_snippet! # Allow write(create) snippet - before_filter :authorize_write_project_snippet!, only: [:new, :create] + before_action :authorize_write_project_snippet!, only: [:new, :create] # Allow modify snippet - before_filter :authorize_modify_project_snippet!, only: [:edit, :update] + before_action :authorize_modify_project_snippet!, only: [:edit, :update] # Allow destroy snippet - before_filter :authorize_admin_project_snippet!, only: [:destroy] + before_action :authorize_admin_project_snippet!, only: [:destroy] respond_to :html diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index 83f4937bce36838f944b786684e014cfff440f3e..f565fbbbbc3fd9a2dcf9c52479cebbcd504c9944 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -1,9 +1,9 @@ class Projects::TagsController < Projects::ApplicationController # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:create] - before_filter :authorize_admin_project!, only: [:destroy] + before_action :require_non_empty_project + before_action :authorize_download_code! + before_action :authorize_push_code!, only: [:create] + before_action :authorize_admin_project!, only: [:destroy] def index sorted = VersionSorter.rsort(@repository.tag_names) diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index b23010bf59546dd664002c89c74789b466d10f3b..b659e15f2429f9fdb03cdeb448b171e9ec3415b0 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -2,9 +2,9 @@ class Projects::TreeController < Projects::ApplicationController include ExtractsPath - before_filter :require_non_empty_project, except: [:new, :create] - before_filter :assign_ref_vars - before_filter :authorize_download_code! + before_action :require_non_empty_project, except: [:new, :create] + before_action :assign_ref_vars + before_action :authorize_download_code! def show if tree.entries.empty? diff --git a/app/controllers/projects/uploads_controller.rb b/app/controllers/projects/uploads_controller.rb index 276dced865678e1f85bf72f2307bc39a2cb3e16a..6153ca2dc1bbe9cbb50fdf9f060533094a3015c2 100644 --- a/app/controllers/projects/uploads_controller.rb +++ b/app/controllers/projects/uploads_controller.rb @@ -1,11 +1,11 @@ class Projects::UploadsController < Projects::ApplicationController layout 'project' - # We want to skip these filters for only the `show` action if `image?` is true, + # We want to skip these filters for only the `show` action if `image?` is true, # but `skip_before_filter` doesn't work with both `only` and `if`, so we accomplish the same like this. skipped_filters = [:authenticate_user!, :reject_blocked!, :project, :repository] - skip_before_filter *skipped_filters, only: [:show] - before_filter *skipped_filters, only: [:show], unless: :image? + skip_before_action *skipped_filters, only: [:show] + before_action *skipped_filters, only: [:show], unless: :image? def create link_to_file = ::Projects::UploadService.new(project, params[:file]). @@ -40,7 +40,7 @@ class Projects::UploadsController < Projects::ApplicationController file_project = Project.find_with_namespace("#{namespace}/#{id}") if file_project.nil? - @uploader = nil + @uploader = nil return end diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index aeb7f0699f577d74e4c67848608f71bb5db35672..36ef86e190973374af9fab4cfcf1675e4c067e2a 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -1,10 +1,10 @@ require 'project_wiki' class Projects::WikisController < Projects::ApplicationController - before_filter :authorize_read_wiki! - before_filter :authorize_write_wiki!, only: [:edit, :create, :history] - before_filter :authorize_admin_wiki!, only: :destroy - before_filter :load_project_wiki + before_action :authorize_read_wiki! + before_action :authorize_write_wiki!, only: [:edit, :create, :history] + before_action :authorize_admin_wiki!, only: :destroy + before_action :load_project_wiki include WikiHelper def pages diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0f28794b736e66a6c10b6f1f706beffeacb6bd9e..1422f2b8a4c40df9289d1a1f1be534c8199271e9 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,13 +1,13 @@ class ProjectsController < ApplicationController prepend_before_filter :render_go_import, only: [:show] - skip_before_filter :authenticate_user!, only: [:show] - before_filter :project, except: [:new, :create] - before_filter :repository, except: [:new, :create] + skip_before_action :authenticate_user!, only: [:show] + before_action :project, except: [:new, :create] + before_action :repository, except: [:new, :create] # Authorize - before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] - before_filter :set_title, only: [:new, :create] - before_filter :event_filter, only: :show + before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] + before_action :set_title, only: [:new, :create] + before_action :event_filter, only: :show layout 'navless', only: [:new, :create, :fork] diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 38d116a4ee3595bdedee46370726c7300dfa37d9..830751a989f25042cd994fa4bb3892776ab8a894 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,5 +1,5 @@ class RegistrationsController < Devise::RegistrationsController - before_filter :signup_enabled? + before_action :signup_enabled? def new redirect_to(new_user_session_path) diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index cd52556b20385f00049f92bc4770fd366d550dd2..1eff3dd29de51fb392ebd59d57a51946594e9aa7 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,15 +1,15 @@ class SnippetsController < ApplicationController - before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] + before_action :snippet, only: [:show, :edit, :destroy, :update, :raw] # Allow modify snippet - before_filter :authorize_modify_snippet!, only: [:edit, :update] + before_action :authorize_modify_snippet!, only: [:edit, :update] # Allow destroy snippet - before_filter :authorize_admin_snippet!, only: [:destroy] + before_action :authorize_admin_snippet!, only: [:destroy] - before_filter :set_title + before_action :set_title - skip_before_filter :authenticate_user!, only: [:index, :user_index, :show, :raw] + skip_before_action :authenticate_user!, only: [:index, :user_index, :show, :raw] respond_to :html diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index c5f3da54ea23b63338585b4242fdac5f32463cd0..17edff68be27cf075750818b250261ee2f57cdee 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -1,6 +1,6 @@ class UploadsController < ApplicationController - skip_before_filter :authenticate_user! - before_filter :find_model, :authorize_access! + skip_before_action :authenticate_user! + before_action :find_model, :authorize_access! def show uploader = @model.send(upload_mount) @@ -28,7 +28,7 @@ class UploadsController < ApplicationController end def authorize_access! - authorized = + authorized = case @model when Project can?(current_user, :read_project, @model) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 679d6897ce97a38db06b7578387b431f6731c522..460cc868b35cee1b7aef1942d4dda40408fc9779 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,6 @@ class UsersController < ApplicationController - skip_before_filter :authenticate_user! - before_filter :set_user + skip_before_action :authenticate_user! + before_action :set_user layout :determine_layout def show diff --git a/db/schema.rb b/db/schema.rb index 1aee37b2e6184df956560e339fc6caee78911641..2b7e27e3a3165e243d5065a3be799d83914e560a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -470,7 +470,6 @@ ActiveRecord::Schema.define(version: 20150417122318) do t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" - t.datetime "last_credential_check_at" t.string "avatar" t.string "confirmation_token" t.datetime "confirmed_at" @@ -478,6 +477,7 @@ ActiveRecord::Schema.define(version: 20150417122318) do t.string "unconfirmed_email" t.boolean "hide_no_ssh_key", default: false t.string "website_url", default: "", null: false + t.datetime "last_credential_check_at" t.string "github_access_token" t.string "gitlab_access_token" t.string "notification_email"