Commit e9cefd1e authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'frozen-string-ee-app-helpers' into 'master'

Enable some frozen string in ee/app

See merge request gitlab-org/gitlab-ee!8667
parents 18bfce52 579e9768
# frozen_string_literal: true
module AuditEventsHelper
def human_text(details)
details.map { |key, value| select_keys(key, value) }.join(" ").humanize
......
# frozen_string_literal: true
module AuditLogsHelper
def event_type_options
[
......
# frozen_string_literal: true
module AuditorUserHelper
include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module BatchCommentsHelper
def batch_comments_enabled?
current_user.present? && @project.feature_available?(:batch_comments, current_user)
......
# frozen_string_literal: true
module BillingPlansHelper
def subscription_plan_info(plans_data, current_plan_code)
plans_data.find { |plan| plan.code == current_plan_code }
......
# frozen_string_literal: true
module EE
module AppearancesHelper
def header_message
......@@ -26,10 +28,10 @@ module EE
end
def message_style
style = ''
style = []
style << "background-color: #{current_appearance.message_background_color};"
style << "color: #{current_appearance.message_font_color}"
style
style.join
end
end
end
# frozen_string_literal: true
module EE
module ApplicationHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module ApplicationSettingsHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module AuthHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module AwardEmojiHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module BoardsHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module BranchesHelper
# Returns a hash were keys are types of access levels (user, role), and
......
# frozen_string_literal: true
module EE
module ButtonHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module DashboardHelper
def controller_action_to_child_dashboards(controller = controller_name, action = action_name)
......
# frozen_string_literal: true
module EE
module EmailsHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module EnvironmentsHelper
def metrics_data(project, environment)
......
# frozen_string_literal: true
module EE
module FormHelper
def issue_assignees_dropdown_options
......
# frozen_string_literal: true
module EE
module GitlabRoutingHelper
include ::ProjectsHelper
......
# frozen_string_literal: true
module EE
module GroupsHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module ImportHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module IssuablesHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module IssuesHelper
def weight_dropdown_tag(issuable, opts = {}, &block)
......
# frozen_string_literal: true
module EE
module LockHelper
def lock_file_link(project = @project, path = @path, html_options: {})
......
# frozen_string_literal: true
module EE
module MergeRequestsHelper
def render_items_list(items, separator = "and")
......
# frozen_string_literal: true
module EE
module MilestonesHelper
def burndown_chart(milestone)
......@@ -32,9 +34,9 @@ module EE
end
if message
message += link_to "About burndown charts", help_page_path('user/project/milestones/index', anchor: 'burndown-charts'), class: 'burndown-docs-link'
link = link_to "About burndown charts", help_page_path('user/project/milestones/index', anchor: 'burndown-charts'), class: 'burndown-docs-link'
content_tag(:div, message.html_safe, id: "data-warning", class: "settings-message prepend-top-20")
content_tag(:div, (message + link).html_safe, id: "data-warning", class: "settings-message prepend-top-20")
end
end
......
# frozen_string_literal: true
module EE
module NamespacesHelper
def namespace_shared_runner_limits_quota(namespace)
......
# frozen_string_literal: true
module EE
module NavHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module NotesHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module ProjectsHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module SamlProvidersHelper
def group_saml_configured?
......
# frozen_string_literal: true
module EE
module ServicesHelper
def add_to_slack_link(project, slack_app_id)
......
# frozen_string_literal: true
module EE
module SystemNoteHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module TodosHelper
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module UserCalloutsHelper
GOLD_TRIAL = 'gold_trial'.freeze
......
# frozen_string_literal: true
module EpicsHelper
def epic_show_app_data(epic, opts)
group = epic.group
......
# frozen_string_literal: true
module GroupMembersHelper
def clear_ldap_permission_cache_message
markdown(
......
# frozen_string_literal: true
module LicenseHelper
include ActionView::Helpers::AssetTagHelper
include ActionView::Helpers::UrlHelper
......
# frozen_string_literal: true
module MirrorHelper
def render_mirror_failed_message(raw_message:)
mirror_last_update_at = @project.import_state.last_update_at
......@@ -15,14 +17,14 @@ module MirrorHelper
end
def branch_diverged_tooltip_message
message = s_('Branches|The branch could not be updated automatically because it has diverged from its upstream counterpart.')
message = [s_('Branches|The branch could not be updated automatically because it has diverged from its upstream counterpart.')]
if can?(current_user, :push_code, @project)
message << '<br>'
message << s_("Branches|To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above.")
end
message
message.join
end
def options_for_mirror_user
......
# frozen_string_literal: true
module PathLocksHelper
def can_unlock?(path_lock, current_user = @current_user, project = @project)
can?(current_user, :admin_path_locks, project) || path_lock.user == current_user
......
# frozen_string_literal: true
module ProtectedEnvironmentsHelper
def protected_environments_enabled?(project)
project.protected_environments_feature_available?
......
# frozen_string_literal: true
module PushRulesHelper
def reject_unsigned_commits_description(push_rule)
message = s_("ProjectSettings|Only signed commits can be pushed to this repository.")
......
# frozen_string_literal: true
module EE
module Notify
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module Preview
module NotifyPreview
......
# frozen_string_literal: true
module Emails
module AdminNotification
def send_admin_notification(user_id, subject, body)
......
# frozen_string_literal: true
module Emails
module CsvExport
def issues_csv_email(user, project, csv_data, export_status)
......
# frozen_string_literal: true
module Emails
module EE
module Notes
......
# frozen_string_literal: true
module Emails
module EE
module Projects
......
# frozen_string_literal: true
module Emails
module ServiceDesk
extend ActiveSupport::Concern
......
# frozen_string_literal: true
class Approval < ActiveRecord::Base
belongs_to :user
belongs_to :merge_request
......
# frozen_string_literal: true
class Approver < ActiveRecord::Base
belongs_to :target, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
belongs_to :user
......
# frozen_string_literal: true
class ApproverGroup < ActiveRecord::Base
belongs_to :target, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
belongs_to :group
......
# frozen_string_literal: true
class BoardAssignee < ActiveRecord::Base
belongs_to :board
belongs_to :assignee, class_name: 'User'
......
# frozen_string_literal: true
class BoardLabel < ActiveRecord::Base
belongs_to :board
belongs_to :label
......
# frozen_string_literal: true
class Burndown
include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module Ci
class PipelineChatData < ActiveRecord::Base
self.table_name = 'ci_pipeline_chat_data'
......
# frozen_string_literal: true
module Ci
module Sources
class Pipeline < ActiveRecord::Base
......
# frozen_string_literal: true
module Approvable
# A method related to approvers that is user facing
# should be moved to VisibleApprovable because
......
# frozen_string_literal: true
module CustomModelNaming
# Extracted from: https://github.com/stevenbarragan/spree_random_subscriptions/blob/5426ccaf8a2084c495b2cac9dfbd27e30ade0cec/lib/custom_model_naming.rb
......
# frozen_string_literal: true
module EE
module DeploymentPlatform
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module KubernetesService
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module Participable
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module PrometheusAdapter
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module ProtectedBranch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module ProtectedRef
def protected_ref_access_levels(*types)
......
# frozen_string_literal: true
# EE-specific code related to protected branch/tag access levels.
#
# Note: Don't directly include this concern into a model class.
......
# frozen_string_literal: true
module EE
# Issue position on list boards should be relative to all group projects
module RelativePositioning
......
# frozen_string_literal: true
module Elastic
module IssuesSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module MergeRequestsSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module MilestonesSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module NotesSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module ProjectsSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module RepositoriesSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module SnippetsSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Elastic
module WikiRepositoriesSearch
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Geo
module Model
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Geo::Syncable
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module HasEnvironmentScope
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module ObjectStorable
extend ActiveSupport::Concern
......
# frozen_string_literal: true
# This module may only be used by presenters or modules
# that include the Approvable concern
module VisibleApprovable
......
# frozen_string_literal: true
module EE
module Appearance
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# ApplicationSetting EE mixin
#
......
# frozen_string_literal: true
module EE
module AuditEvent
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module Board
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# BroadcastMessage EE mixin
#
......
# frozen_string_literal: true
module EE
module Ci
# Build EE mixin
......
# frozen_string_literal: true
module EE
# CI::JobArtifact EE mixin
#
......
# frozen_string_literal: true
module EE
module Ci
module Pipeline
......
# frozen_string_literal: true
module EE
module Ci
module Runner
......
# frozen_string_literal: true
module EE
module Clusters
module Applications
......
# frozen_string_literal: true
module EE
module Clusters
module Cluster
......
# frozen_string_literal: true
module EE
module Environment
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module Epic
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module GlobalMilestone
def supports_weight?
......
# frozen_string_literal: true
module EE
# Group EE mixin
#
......
# frozen_string_literal: true
module EE
module GroupMilestone
def supports_weight?
......
# frozen_string_literal: true
module EE
module Identity
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module Issue
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# LFS Object EE mixin
#
......
# frozen_string_literal: true
module EE
module List
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module MergeRequest
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# Namespace EE mixin
#
......
# frozen_string_literal: true
module EE
module Note
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# Project EE mixin
#
......
# frozen_string_literal: true
module EE
module ProjectAuthorization
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module ProjectImportData
# Required for integration with MirrorAuthentication
......
# frozen_string_literal: true
module EE
module ProjectImportState
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module ProjectTeam
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module PrometheusMetric
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module RemoteMirror
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
# Repository EE mixin
#
......
# frozen_string_literal: true
module EE
module Service
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module EE
module SlackSlashCommandsService
def chat_responder
......
# frozen_string_literal: true
module EE
module SystemNoteMetadata
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
module Todo
extend ::Gitlab::Utils::Override
......
# frozen_string_literal: true
module EE
# Upload EE mixin
#
......
# frozen_string_literal: true
module EE
# User EE mixin
#
......
# frozen_string_literal: true
class Epic::Metrics < ActiveRecord::Base
belongs_to :epic
......
# frozen_string_literal: true
class EpicIssue < ActiveRecord::Base
include RelativePositioning
......
# frozen_string_literal: true
class Geo::BaseFdw < Geo::TrackingBase
self.abstract_class = true
end
# frozen_string_literal: true
class Geo::BaseRegistry < Geo::TrackingBase
self.abstract_class = true
end
# frozen_string_literal: true
class Geo::DeletedProject
attr_reader :id, :name, :disk_path
......
# frozen_string_literal: true
module Geo
class EventLog < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
class Geo::EventLogState < Geo::BaseRegistry
self.primary_key = :event_id
......
# frozen_string_literal: true
module Geo
module Fdw
module Ci
......
# frozen_string_literal: true
module Geo
module Fdw
class LfsObject < ::Geo::BaseFdw
......
# frozen_string_literal: true
module Geo
module Fdw
class ProjectFeature < ::Geo::BaseFdw
......
# frozen_string_literal: true
module Geo
module Fdw
class ProjectRepositoryState < ::Geo::BaseFdw
......
# frozen_string_literal: true
module Geo
module Fdw
class Upload < ::Geo::BaseFdw
......
# frozen_string_literal: true
class Geo::FileRegistry < Geo::BaseRegistry
include Geo::Syncable
......
# frozen_string_literal: true
module Geo
class HashedStorageAttachmentsEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class HashedStorageMigratedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class JobArtifactDeletedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
class Geo::JobArtifactRegistry < Geo::BaseRegistry
include Geo::Syncable
end
# frozen_string_literal: true
module Geo
class LfsObjectDeletedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class RepositoriesChangedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class RepositoryCreatedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class RepositoryDeletedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class RepositoryRenamedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
module Geo
class RepositoryUpdatedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
# This module is intended to centralize all database access to the secondary
# tracking database for Geo.
module Geo
......@@ -14,7 +16,7 @@ module Geo
def self.connection
unless ::Gitlab::Geo.geo_database_configured?
message = NOT_CONFIGURED_MSG
message += "\nIn the GDK root, try running `make geo-setup`" if Rails.env.development?
message = "#{message}\nIn the GDK root, try running `make geo-setup`" if Rails.env.development?
raise SecondaryNotConfigured.new(message)
end
......
# frozen_string_literal: true
module Geo
class UploadDeletedEvent < ActiveRecord::Base
include Geo::Model
......
# frozen_string_literal: true
class GeoNode < ActiveRecord::Base
include Presentable
......
# frozen_string_literal: true
class GeoNodeNamespaceLink < ActiveRecord::Base
belongs_to :geo_node, inverse_of: :namespaces
belongs_to :namespace
......
# frozen_string_literal: true
class GeoNodeStatus < ActiveRecord::Base
include ShaAttribute
......
# frozen_string_literal: true
class HistoricalData < ActiveRecord::Base
validates :date, presence: true
......
# frozen_string_literal: true
class GroupHook < ProjectHook
include CustomModelNaming
include TriggerableHooks
......
# frozen_string_literal: true
class IndexStatus < ActiveRecord::Base
belongs_to :project
......
# frozen_string_literal: true
class IssueLink < ActiveRecord::Base
belongs_to :source, class_name: 'Issue'
belongs_to :target, class_name: 'Issue'
......
# frozen_string_literal: true
class LdapGroupLink < ActiveRecord::Base
include Gitlab::Access
belongs_to :group
......
# frozen_string_literal: true
class LDAPKey < Key
end
# frozen_string_literal: true
class License < ActiveRecord::Base
include ActionView::Helpers::NumberHelper
......@@ -434,25 +436,25 @@ class License < ActiveRecord::Base
add_limit_error(user_count: current_active_users_count)
end
else
message = "You have applied a True-up for #{trueup_qty} #{"user".pluralize(trueup_qty)} "
message << "but you need one for #{expected_trueup_qty} #{"user".pluralize(expected_trueup_qty)}. "
message = ["You have applied a True-up for #{trueup_qty} #{"user".pluralize(trueup_qty)}"]
message << "but you need one for #{expected_trueup_qty} #{"user".pluralize(expected_trueup_qty)}."
message << "Please contact sales at renewals@gitlab.com"
self.errors.add(:base, message)
self.errors.add(:base, message.join(' '))
end
end
def add_limit_error(current_period: true, user_count:)
overage = user_count - restricted_user_count
message = current_period ? "This GitLab installation currently has " : "During the year before this license started, this GitLab installation had "
message << "#{number_with_delimiter(user_count)} active #{"user".pluralize(user_count)}, "
message << "exceeding this license's limit of #{number_with_delimiter(restricted_user_count)} by "
message << "#{number_with_delimiter(overage)} #{"user".pluralize(overage)}. "
message << "Please upload a license for at least "
message = [current_period ? "This GitLab installation currently has" : "During the year before this license started, this GitLab installation had"]
message << "#{number_with_delimiter(user_count)} active #{"user".pluralize(user_count)},"
message << "exceeding this license's limit of #{number_with_delimiter(restricted_user_count)} by"
message << "#{number_with_delimiter(overage)} #{"user".pluralize(overage)}."
message << "Please upload a license for at least"
message << "#{number_with_delimiter(user_count)} #{"user".pluralize(user_count)} or contact sales at renewals@gitlab.com"
self.errors.add(:base, message)
self.errors.add(:base, message.join(' '))
end
def not_expired
......
# frozen_string_literal: true
class NamespaceStatistics < ActiveRecord::Base
belongs_to :namespace
......
# frozen_string_literal: true
module Operations
class FeatureFlag < ActiveRecord::Base
self.table_name = 'operations_feature_flags'
......
# frozen_string_literal: true
module Operations
class FeatureFlagsClient < ActiveRecord::Base
include TokenAuthenticatable
......
# frozen_string_literal: true
class PathLock < ActiveRecord::Base
belongs_to :project
belongs_to :user
......
# frozen_string_literal: true
# `pg_replication_slots` is a PostgreSQL view
class PgReplicationSlot
def self.count
......
# frozen_string_literal: true
class Plan < ActiveRecord::Base
has_many :namespaces
end
# frozen_string_literal: true
class ProjectRepositoryState < ActiveRecord::Base
include IgnorableColumn
include ShaAttribute
......
# frozen_string_literal: true
class GithubService < Service
include Gitlab::Routing
include ActionView::Helpers::UrlHelper
......
# frozen_string_literal: true
class GithubService
class RemoteProject
def initialize(url)
......
# frozen_string_literal: true
class GithubService
class StatusMessage
include Gitlab::Routing
......
# frozen_string_literal: true
class GithubService
class StatusNotifier
def initialize(access_token, repo_path, api_endpoint: nil)
......
# frozen_string_literal: true
class GitlabSlackApplicationService < Service
default_value_for :category, 'chat'
......
# frozen_string_literal: true
require 'uri'
class JenkinsDeprecatedService < CiService
......
# frozen_string_literal: true
class JenkinsService < CiService
prop_accessor :jenkins_url, :project_name, :username, :password
......
# frozen_string_literal: true
class PrometheusAlert < ActiveRecord::Base
OPERATORS_MAP = {
lt: "<",
......
# frozen_string_literal: true
class ProtectedBranch::UnprotectAccessLevel < ActiveRecord::Base
include ProtectedBranchAccess
end
# frozen_string_literal: true
class PushRule < ActiveRecord::Base
extend Gitlab::Cache::RequestCache
......
# frozen_string_literal: true
class SamlProvider < ActiveRecord::Base
belongs_to :group
has_many :identities
......
# frozen_string_literal: true
class SlackIntegration < ActiveRecord::Base
belongs_to :service
......
# frozen_string_literal: true
require 'digest'
# This is an in-memory structure only. The repository storage configuration is
# in gitlab.yml and not in the database. This model makes it easier to work
......
---
title: Enable some frozen string in ee/app
merge_request: 8667
author: gfyoung
type: performance
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