Commit 711e9f07 authored by Stan Hu's avatar Stan Hu

Merge branch 'frozen-string-app-controller' into 'master'

Enable frozen string in app/controllers/**/*.rb

See merge request gitlab-org/gitlab-ce!21736
parents 9dff8567 73322a0e
# frozen_string_literal: true
class AbuseReportsController < ApplicationController class AbuseReportsController < ApplicationController
before_action :set_user, only: [:new] before_action :set_user, only: [:new]
......
# frozen_string_literal: true
class Admin::AbuseReportsController < Admin::ApplicationController class Admin::AbuseReportsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def index def index
......
# frozen_string_literal: true
class Admin::AppearancesController < Admin::ApplicationController class Admin::AppearancesController < Admin::ApplicationController
before_action :set_appearance, except: :create before_action :set_appearance, except: :create
......
# frozen_string_literal: true
# Provides a base class for Admin controllers to subclass # Provides a base class for Admin controllers to subclass
# #
# Automatically sets the layout and ensures an administrator is logged in # Automatically sets the layout and ensures an administrator is logged in
......
# frozen_string_literal: true
class Admin::ApplicationSettingsController < Admin::ApplicationController class Admin::ApplicationSettingsController < Admin::ApplicationController
include InternalRedirect include InternalRedirect
before_action :set_application_setting before_action :set_application_setting
......
# frozen_string_literal: true
class Admin::ApplicationsController < Admin::ApplicationController class Admin::ApplicationsController < Admin::ApplicationController
include OauthApplications include OauthApplications
......
# frozen_string_literal: true
class Admin::BackgroundJobsController < Admin::ApplicationController class Admin::BackgroundJobsController < Admin::ApplicationController
def show def show
ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command))
......
# frozen_string_literal: true
class Admin::BroadcastMessagesController < Admin::ApplicationController class Admin::BroadcastMessagesController < Admin::ApplicationController
include BroadcastMessagesHelper include BroadcastMessagesHelper
......
# frozen_string_literal: true
class Admin::DashboardController < Admin::ApplicationController class Admin::DashboardController < Admin::ApplicationController
include CountHelper include CountHelper
......
# frozen_string_literal: true
class Admin::DeployKeysController < Admin::ApplicationController class Admin::DeployKeysController < Admin::ApplicationController
before_action :deploy_keys, only: [:index] before_action :deploy_keys, only: [:index]
before_action :deploy_key, only: [:destroy, :edit, :update] before_action :deploy_key, only: [:destroy, :edit, :update]
......
# frozen_string_literal: true
class Admin::GitalyServersController < Admin::ApplicationController class Admin::GitalyServersController < Admin::ApplicationController
def index def index
@gitaly_servers = Gitaly::Server.all @gitaly_servers = Gitaly::Server.all
......
# frozen_string_literal: true
class Admin::GroupsController < Admin::ApplicationController class Admin::GroupsController < Admin::ApplicationController
include MembersPresentation include MembersPresentation
......
# frozen_string_literal: true
class Admin::HealthCheckController < Admin::ApplicationController class Admin::HealthCheckController < Admin::ApplicationController
def show def show
@errors = HealthCheck::Utils.process_checks(['standard']) @errors = HealthCheck::Utils.process_checks(['standard'])
......
# frozen_string_literal: true
class Admin::HookLogsController < Admin::ApplicationController class Admin::HookLogsController < Admin::ApplicationController
include HooksExecution include HooksExecution
......
# frozen_string_literal: true
class Admin::HooksController < Admin::ApplicationController class Admin::HooksController < Admin::ApplicationController
include HooksExecution include HooksExecution
......
# frozen_string_literal: true
class Admin::IdentitiesController < Admin::ApplicationController class Admin::IdentitiesController < Admin::ApplicationController
before_action :user before_action :user
before_action :identity, except: [:index, :new, :create] before_action :identity, except: [:index, :new, :create]
......
# frozen_string_literal: true
class Admin::ImpersonationTokensController < Admin::ApplicationController class Admin::ImpersonationTokensController < Admin::ApplicationController
before_action :user before_action :user
......
# frozen_string_literal: true
class Admin::ImpersonationsController < Admin::ApplicationController class Admin::ImpersonationsController < Admin::ApplicationController
skip_before_action :authenticate_admin! skip_before_action :authenticate_admin!
before_action :authenticate_impersonator! before_action :authenticate_impersonator!
......
# frozen_string_literal: true
class Admin::JobsController < Admin::ApplicationController class Admin::JobsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def index def index
......
# frozen_string_literal: true
class Admin::KeysController < Admin::ApplicationController class Admin::KeysController < Admin::ApplicationController
before_action :user, only: [:show, :destroy] before_action :user, only: [:show, :destroy]
......
# frozen_string_literal: true
class Admin::LabelsController < Admin::ApplicationController class Admin::LabelsController < Admin::ApplicationController
before_action :set_label, only: [:show, :edit, :update, :destroy] before_action :set_label, only: [:show, :edit, :update, :destroy]
......
# frozen_string_literal: true
class Admin::LogsController < Admin::ApplicationController class Admin::LogsController < Admin::ApplicationController
before_action :loggers before_action :loggers
......
# frozen_string_literal: true
class Admin::ProjectsController < Admin::ApplicationController class Admin::ProjectsController < Admin::ApplicationController
include MembersPresentation include MembersPresentation
......
# frozen_string_literal: true
class Admin::RequestsProfilesController < Admin::ApplicationController class Admin::RequestsProfilesController < Admin::ApplicationController
def index def index
@profile_token = Gitlab::RequestProfiler.profile_token @profile_token = Gitlab::RequestProfiler.profile_token
......
# frozen_string_literal: true
class Admin::RunnerProjectsController < Admin::ApplicationController class Admin::RunnerProjectsController < Admin::ApplicationController
before_action :project, only: [:create] before_action :project, only: [:create]
......
# frozen_string_literal: true
class Admin::RunnersController < Admin::ApplicationController class Admin::RunnersController < Admin::ApplicationController
before_action :runner, except: :index before_action :runner, except: :index
......
# frozen_string_literal: true
class Admin::SpamLogsController < Admin::ApplicationController class Admin::SpamLogsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def index def index
......
# frozen_string_literal: true
class Admin::SystemInfoController < Admin::ApplicationController class Admin::SystemInfoController < Admin::ApplicationController
EXCLUDED_MOUNT_OPTIONS = [ EXCLUDED_MOUNT_OPTIONS = [
'nobrowse', 'nobrowse',
......
# frozen_string_literal: true
class Admin::UsersController < Admin::ApplicationController class Admin::UsersController < Admin::ApplicationController
before_action :user, except: [:index, :new, :create] before_action :user, except: [:index, :new, :create]
......
# frozen_string_literal: true
require 'gon' require 'gon'
require 'fogbugz' require 'fogbugz'
......
# frozen_string_literal: true
class AutocompleteController < ApplicationController class AutocompleteController < ApplicationController
skip_before_action :authenticate_user!, only: [:users, :award_emojis] skip_before_action :authenticate_user!, only: [:users, :award_emojis]
......
# frozen_string_literal: true
module Boards module Boards
class ApplicationController < ::ApplicationController class ApplicationController < ::ApplicationController
respond_to :json respond_to :json
......
# frozen_string_literal: true
module Boards module Boards
class IssuesController < Boards::ApplicationController class IssuesController < Boards::ApplicationController
include BoardsResponses include BoardsResponses
......
# frozen_string_literal: true
module Boards module Boards
class ListsController < Boards::ApplicationController class ListsController < Boards::ApplicationController
include BoardsResponses include BoardsResponses
......
# frozen_string_literal: true
module Ci module Ci
class LintsController < ::ApplicationController class LintsController < ::ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
......
# frozen_string_literal: true
module AcceptsPendingInvitations module AcceptsPendingInvitations
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
# == AuthenticatesWithTwoFactor # == AuthenticatesWithTwoFactor
# #
# Controller concern to handle two-factor authentication # Controller concern to handle two-factor authentication
......
# frozen_string_literal: true
module BoardsResponses module BoardsResponses
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module ChecksCollaboration module ChecksCollaboration
def can_collaborate_with_project?(project, ref: nil) def can_collaborate_with_project?(project, ref: nil)
return true if can?(current_user, :push_code, project) return true if can?(current_user, :push_code, project)
......
# frozen_string_literal: true
module ContinueParams module ContinueParams
include InternalRedirect include InternalRedirect
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module ControllerWithCrossProjectAccessCheck module ControllerWithCrossProjectAccessCheck
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module CreatesCommit module CreatesCommit
extend ActiveSupport::Concern extend ActiveSupport::Concern
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
...@@ -65,7 +67,7 @@ module CreatesCommit ...@@ -65,7 +67,7 @@ module CreatesCommit
flash[:notice] = nil flash[:notice] = nil
else else
target = different_project? ? "project" : "branch" target = different_project? ? "project" : "branch"
flash[:notice] << " You can now submit a merge request to get this change into the original #{target}." flash[:notice] = flash[:notice] + " You can now submit a merge request to get this change into the original #{target}."
end end
end end
end end
......
# frozen_string_literal: true
module CycleAnalyticsParams module CycleAnalyticsParams
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module DiffForPath module DiffForPath
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
# == EnforcesTwoFactorAuthentication # == EnforcesTwoFactorAuthentication
# #
# Controller concern to enforce two-factor authentication requirements # Controller concern to enforce two-factor authentication requirements
......
# frozen_string_literal: true
module GroupTree module GroupTree
# rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop:disable Gitlab/ModuleWithInstanceVariables
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
# frozen_string_literal: true
module HooksExecution module HooksExecution
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module InternalRedirect module InternalRedirect
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module IssuableActions module IssuableActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module IssuableCollections module IssuableCollections
extend ActiveSupport::Concern extend ActiveSupport::Concern
include CookiesHelper include CookiesHelper
......
# frozen_string_literal: true
module IssuesAction module IssuesAction
extend ActiveSupport::Concern extend ActiveSupport::Concern
include IssuableCollections include IssuableCollections
......
# frozen_string_literal: true
module IssuesCalendar module IssuesCalendar
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
# This concern assumes: # This concern assumes:
# - a `#project` accessor # - a `#project` accessor
# - a `#user` accessor # - a `#user` accessor
......
# frozen_string_literal: true
module MembersPresentation module MembersPresentation
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module MembershipActions module MembershipActions
include MembersPresentation include MembersPresentation
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module MergeRequestsAction module MergeRequestsAction
extend ActiveSupport::Concern extend ActiveSupport::Concern
include IssuableCollections include IssuableCollections
......
# frozen_string_literal: true
module MilestoneActions module MilestoneActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module NotesActions module NotesActions
include RendersNotes include RendersNotes
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module OauthApplications module OauthApplications
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module ParamsBackwardCompatibility module ParamsBackwardCompatibility
private private
......
# frozen_string_literal: true
module PreviewMarkdown module PreviewMarkdown
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module RendersBlob module RendersBlob
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module RendersCommits module RendersCommits
def limited_commits(commits) def limited_commits(commits)
if commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE if commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
......
# frozen_string_literal: true
module RendersMemberAccess module RendersMemberAccess
def prepare_groups_for_rendering(groups) def prepare_groups_for_rendering(groups)
preload_max_member_access_for_collection(Group, groups) preload_max_member_access_for_collection(Group, groups)
......
# frozen_string_literal: true
module RendersNotes module RendersNotes
# rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop:disable Gitlab/ModuleWithInstanceVariables
def prepare_notes_for_rendering(notes, noteable = nil) def prepare_notes_for_rendering(notes, noteable = nil)
......
# frozen_string_literal: true
module RepositorySettingsRedirect module RepositorySettingsRedirect
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module RequiresWhitelistedMonitoringClient module RequiresWhitelistedMonitoringClient
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module RoutableActions module RoutableActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module SendFileUpload module SendFileUpload
def send_upload(file_upload, send_params: {}, redirect_params: {}, attachment: nil, disposition: 'attachment') def send_upload(file_upload, send_params: {}, redirect_params: {}, attachment: nil, disposition: 'attachment')
if attachment if attachment
......
# frozen_string_literal: true
module ServiceParams module ServiceParams
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module SnippetsActions module SnippetsActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module SpammableActions module SpammableActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module TodosActions module TodosActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module ToggleAwardEmoji module ToggleAwardEmoji
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module ToggleSubscriptionAction module ToggleSubscriptionAction
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module UploadsActions module UploadsActions
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module WithPerformanceBar module WithPerformanceBar
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module WorkhorseRequest module WorkhorseRequest
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
class ConfirmationsController < Devise::ConfirmationsController class ConfirmationsController < Devise::ConfirmationsController
include AcceptsPendingInvitations include AcceptsPendingInvitations
...@@ -20,7 +22,7 @@ class ConfirmationsController < Devise::ConfirmationsController ...@@ -20,7 +22,7 @@ class ConfirmationsController < Devise::ConfirmationsController
after_sign_in(resource) after_sign_in(resource)
else else
Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}") Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}")
flash[:notice] += " Please sign in." flash[:notice] = flash[:notice] + " Please sign in."
new_session_path(:user, anchor: 'login-pane') new_session_path(:user, anchor: 'login-pane')
end end
end end
......
# frozen_string_literal: true
class DashboardController < Dashboard::ApplicationController class DashboardController < Dashboard::ApplicationController
include IssuesAction include IssuesAction
include MergeRequestsAction include MergeRequestsAction
......
# frozen_string_literal: true
class GraphqlController < ApplicationController class GraphqlController < ApplicationController
# Unauthenticated users have access to the API for public data # Unauthenticated users have access to the API for public data
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
......
# frozen_string_literal: true
class GroupsController < Groups::ApplicationController class GroupsController < Groups::ApplicationController
include API::Helpers::RelatedResourcesHelpers include API::Helpers::RelatedResourcesHelpers
include IssuesAction include IssuesAction
......
# frozen_string_literal: true
class HealthCheckController < HealthCheck::HealthCheckController class HealthCheckController < HealthCheck::HealthCheckController
include RequiresWhitelistedMonitoringClient include RequiresWhitelistedMonitoringClient
end end
# frozen_string_literal: true
class HealthController < ActionController::Base class HealthController < ActionController::Base
protect_from_forgery with: :exception, except: :storage_check, prepend: true protect_from_forgery with: :exception, except: :storage_check, prepend: true
include RequiresWhitelistedMonitoringClient include RequiresWhitelistedMonitoringClient
......
# frozen_string_literal: true
class HelpController < ApplicationController class HelpController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
......
# frozen_string_literal: true
class IdeController < ApplicationController class IdeController < ApplicationController
layout 'fullscreen' layout 'fullscreen'
......
# frozen_string_literal: true
class InvitesController < ApplicationController class InvitesController < ApplicationController
before_action :member before_action :member
skip_before_action :authenticate_user!, only: :decline skip_before_action :authenticate_user!, only: :decline
...@@ -50,9 +52,9 @@ class InvitesController < ApplicationController ...@@ -50,9 +52,9 @@ class InvitesController < ApplicationController
def authenticate_user! def authenticate_user!
return if current_user return if current_user
notice = "To accept this invitation, sign in" notice = ["To accept this invitation, sign in"]
notice << " or create an account" if Gitlab::CurrentSettings.allow_signup? notice << "or create an account" if Gitlab::CurrentSettings.allow_signup?
notice << "." notice = notice.join(' ') + "."
store_location_for :user, request.fullpath store_location_for :user, request.fullpath
redirect_to new_user_session_path, notice: notice redirect_to new_user_session_path, notice: notice
......
# frozen_string_literal: true
class JwtController < ApplicationController class JwtController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
......
# frozen_string_literal: true
class KodingController < ApplicationController class KodingController < ApplicationController
before_action :check_integration! before_action :check_integration!
layout 'koding' layout 'koding'
......
# frozen_string_literal: true
class MetricsController < ActionController::Base class MetricsController < ActionController::Base
include RequiresWhitelistedMonitoringClient include RequiresWhitelistedMonitoringClient
......
# frozen_string_literal: true
class NotificationSettingsController < ApplicationController class NotificationSettingsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
......
# frozen_string_literal: true
class OmniauthCallbacksController < Devise::OmniauthCallbacksController class OmniauthCallbacksController < Devise::OmniauthCallbacksController
include AuthenticatesWithTwoFactor include AuthenticatesWithTwoFactor
include Devise::Controllers::Rememberable include Devise::Controllers::Rememberable
...@@ -135,14 +137,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -135,14 +137,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def handle_signup_error def handle_signup_error
label = Gitlab::Auth::OAuth::Provider.label_for(oauth['provider']) label = Gitlab::Auth::OAuth::Provider.label_for(oauth['provider'])
message = "Signing in using your #{label} account without a pre-existing GitLab account is not allowed." message = ["Signing in using your #{label} account without a pre-existing GitLab account is not allowed."]
if Gitlab::CurrentSettings.allow_signup? if Gitlab::CurrentSettings.allow_signup?
message << " Create a GitLab account first, and then connect it to your #{label} account." message << "Create a GitLab account first, and then connect it to your #{label} account."
end end
flash[:notice] = message flash[:notice] = message.join(' ')
redirect_to new_user_session_path redirect_to new_user_session_path
end end
......
# frozen_string_literal: true
class PasswordsController < Devise::PasswordsController class PasswordsController < Devise::PasswordsController
skip_before_action :require_no_authentication, only: [:edit, :update] skip_before_action :require_no_authentication, only: [:edit, :update]
......
# frozen_string_literal: true
class ProfilesController < Profiles::ApplicationController class ProfilesController < Profiles::ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
......
# frozen_string_literal: true
class ProjectsController < Projects::ApplicationController class ProjectsController < Projects::ApplicationController
include API::Helpers::RelatedResourcesHelpers include API::Helpers::RelatedResourcesHelpers
include IssuableCollections include IssuableCollections
......
# frozen_string_literal: true
class RegistrationsController < Devise::RegistrationsController class RegistrationsController < Devise::RegistrationsController
include Recaptcha::Verify include Recaptcha::Verify
include AcceptsPendingInvitations include AcceptsPendingInvitations
......
# frozen_string_literal: true
# RootController # RootController
# #
# This controller exists solely to handle requests to `root_url`. When a user is # This controller exists solely to handle requests to `root_url`. When a user is
......
# frozen_string_literal: true
class SearchController < ApplicationController class SearchController < ApplicationController
include ControllerWithCrossProjectAccessCheck include ControllerWithCrossProjectAccessCheck
include SearchHelper include SearchHelper
......
# frozen_string_literal: true
class SentNotificationsController < ApplicationController class SentNotificationsController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
......
# frozen_string_literal: true
class SessionsController < Devise::SessionsController class SessionsController < Devise::SessionsController
include InternalRedirect include InternalRedirect
include AuthenticatesWithTwoFactor include AuthenticatesWithTwoFactor
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment