diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-13 13:26:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-13 13:26:31 +0000 |
commit | b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch) | |
tree | 5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /app/models | |
parent | 25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff) | |
download | gitlab-ce-b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
85 files changed, 188 insertions, 3 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index c9cd0140ed8..92526def144 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -315,3 +315,5 @@ class ApplicationSetting < ApplicationRecord recaptcha_enabled || login_recaptcha_protection_enabled end end + +ApplicationSetting.prepend_if_ee('EE::ApplicationSetting') diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 6ef2914ac11..c2eef500fb0 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -19,3 +19,5 @@ class AuditEvent < ApplicationRecord self.user.name end end + +AuditEvent.prepend_if_ee('EE::AuditEvent') diff --git a/app/models/blob.rb b/app/models/blob.rb index d528bef8b19..a590536d5fe 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -243,3 +243,5 @@ class Blob < SimpleDelegator classes.find { |viewer_class| viewer_class.can_render?(self, verify_binary: verify_binary) } end end + +Blob.prepend_if_ee('EE::Blob') diff --git a/app/models/board.rb b/app/models/board.rb index b5d07f1b282..31011dc4742 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -41,3 +41,5 @@ class Board < ApplicationRecord false end end + +Board.prepend_if_ee('EE::Board') diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 1338a585c9e..dfcf28763ee 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -76,3 +76,5 @@ class BroadcastMessage < ApplicationRecord self.class.cache.expire(CACHE_KEY) end end + +BroadcastMessage.prepend_if_ee('EE::BroadcastMessage') diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb index 644716ba8e7..6c51f650b6a 100644 --- a/app/models/ci/bridge.rb +++ b/app/models/ci/bridge.rb @@ -56,3 +56,5 @@ module Ci end end end + +::Ci::Bridge.prepend_if_ee('::EE::Ci::Bridge') diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 72782827906..71c4501f57b 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -868,3 +868,5 @@ module Ci end end end + +Ci::Build.prepend_if_ee('EE::Ci::Build') diff --git a/app/models/ci/build_runner_session.rb b/app/models/ci/build_runner_session.rb index 8075c15bbaf..b46bbe69c7c 100644 --- a/app/models/ci/build_runner_session.rb +++ b/app/models/ci/build_runner_session.rb @@ -37,3 +37,5 @@ module Ci end end end + +Ci::BuildRunnerSession.prepend_if_ee('EE::Ci::BuildRunnerSession') diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index b4497d8af09..da2758507ce 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -198,3 +198,5 @@ module Ci end end end + +Ci::JobArtifact.prepend_if_ee('EE::Ci::JobArtifact') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 29317cd530d..0c331b0b8c9 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -904,3 +904,5 @@ module Ci end end end + +Ci::Pipeline.prepend_if_ee('EE::Ci::Pipeline') diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb index 0c2bd0aa8eb..cb92aef4bda 100644 --- a/app/models/ci/pipeline_enums.rb +++ b/app/models/ci/pipeline_enums.rb @@ -39,3 +39,5 @@ module Ci end end end + +Ci::PipelineEnums.prepend_if_ee('EE::Ci::PipelineEnums') diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index e0e905ebfa8..c4a4410e8fc 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -35,7 +35,7 @@ module Ci FORM_EDITABLE = %i[description tag_list active run_untagged locked access_level maximum_timeout_human_readable].freeze - self.ignored_columns = %i[is_shared] + self.ignored_columns += %i[is_shared] has_many :builds has_many :runner_projects, inverse_of: :runner, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent @@ -335,3 +335,5 @@ module Ci end end end + +Ci::Runner.prepend_if_ee('EE::Ci::Runner') diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index f31a6b8b50e..7a414d1a5bb 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -117,3 +117,5 @@ module Clusters end end end + +Clusters::Applications::Prometheus.prepend_if_ee('EE::Clusters::Applications::Prometheus') diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index a976093ac0c..7855fb69bd6 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -268,3 +268,5 @@ module Clusters end end end + +Clusters::Cluster.prepend_if_ee('EE::Clusters::Cluster') diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index 37614fbe3ca..89b50d8e8ff 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -201,3 +201,5 @@ module Clusters end end end + +Clusters::Platforms::Kubernetes.prepend_if_ee('EE::Clusters::Platforms::Kubernetes') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 4be4d95b4a1..5d9d3179f9d 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -7,6 +7,8 @@ class CommitStatus < ApplicationRecord include Presentable include EnumWithNil + prepend_if_ee('::EE::CommitStatus') # rubocop: disable Cop/InjectEnterpriseEditionModule + self.table_name = 'ci_builds' belongs_to :user diff --git a/app/models/commit_status_enums.rb b/app/models/commit_status_enums.rb index 45e08fa18fe..a540e291990 100644 --- a/app/models/commit_status_enums.rb +++ b/app/models/commit_status_enums.rb @@ -19,3 +19,5 @@ module CommitStatusEnums } end end + +CommitStatusEnums.prepend_if_ee('EE::CommitStatusEnums') diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index a998d9b7e1b..d02f3731cc2 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -439,3 +439,6 @@ module Issuable respond_to?(:milestone_id) end end + +Issuable.prepend_if_ee('EE::Issuable') # rubocop: disable Cop/InjectEnterpriseEditionModule +Issuable::ClassMethods.prepend_if_ee('EE::Issuable::ClassMethods') diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 2f3f9b399d9..377600ef6e5 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -172,3 +172,5 @@ module Mentionable {} end end + +Mentionable.prepend_if_ee('EE::Mentionable') diff --git a/app/models/concerns/mentionable/reference_regexes.rb b/app/models/concerns/mentionable/reference_regexes.rb index b8fb3f71925..fec31cd262b 100644 --- a/app/models/concerns/mentionable/reference_regexes.rb +++ b/app/models/concerns/mentionable/reference_regexes.rb @@ -34,3 +34,5 @@ module Mentionable end end end + +Mentionable::ReferenceRegexes.prepend_if_ee('EE::Mentionable::ReferenceRegexes') diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb index b3e4df730b4..6caa23ef9b7 100644 --- a/app/models/concerns/noteable.rb +++ b/app/models/concerns/noteable.rb @@ -143,3 +143,6 @@ module Noteable end Noteable.extend(Noteable::ClassMethods) + +Noteable::ClassMethods.prepend_if_ee('EE::Noteable::ClassMethods') # rubocop: disable Cop/InjectEnterpriseEditionModule +Noteable.prepend_if_ee('EE::Noteable') diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index b140fca9b83..af105629398 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -25,7 +25,6 @@ # users = issue.participants module Participable extend ActiveSupport::Concern - class_methods do # Adds a list of participant attributes. Attributes can either be symbols or # Procs. @@ -112,3 +111,5 @@ module Participable end end end + +Participable.prepend_if_ee('EE::Participable') diff --git a/app/models/concerns/prometheus_adapter.rb b/app/models/concerns/prometheus_adapter.rb index 9ac4722c6b1..aab0589f7ca 100644 --- a/app/models/concerns/prometheus_adapter.rb +++ b/app/models/concerns/prometheus_adapter.rb @@ -5,6 +5,8 @@ module PrometheusAdapter included do include ReactiveCaching + # We can't prepend outside of this model due to the use of `included`, so this must stay here. + prepend_if_ee('EE::PrometheusAdapter') # rubocop: disable Cop/InjectEnterpriseEditionModule self.reactive_cache_lease_timeout = 30.seconds self.reactive_cache_refresh_interval = 30.seconds diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb index 0648b4a78e1..ebacc459cb5 100644 --- a/app/models/concerns/protected_ref.rb +++ b/app/models/concerns/protected_ref.rb @@ -67,3 +67,9 @@ module ProtectedRef @ref_matcher ||= RefMatcher.new(self.name) end end + +# Prepending a module into a concern doesn't work very well for class methods, +# since these are defined in a ClassMethods constant. As such, we prepend the +# module directly into ProtectedRef::ClassMethods, instead of prepending it into +# ProtectedRef. +ProtectedRef::ClassMethods.prepend_if_ee('EE::ProtectedRef') diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 208937f2aff..01cb5a14762 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -2,7 +2,6 @@ module ProtectedRefAccess extend ActiveSupport::Concern - HUMAN_ACCESS_LEVELS = { Gitlab::Access::MAINTAINER => "Maintainers", Gitlab::Access::DEVELOPER => "Developers + Maintainers", @@ -51,3 +50,13 @@ module ProtectedRefAccess project.team.max_member_access(user.id) >= access_level end end + +ProtectedRefAccess.include_if_ee('EE::ProtectedRefAccess::Scopes') # rubocop: disable Cop/InjectEnterpriseEditionModule +ProtectedRefAccess.prepend_if_ee('EE::ProtectedRefAccess') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# When using `prepend` (or `include` for that matter), the `ClassMethods` +# constants are not merged. This means that `class_methods` in +# `EE::ProtectedRefAccess` would be ignored. +# +# To work around this, we prepend the `ClassMethods` constant manually. +ProtectedRefAccess::ClassMethods.prepend_if_ee('EE::ProtectedRefAccess::ClassMethods') diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index 70ac873a030..177004deba6 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -47,3 +47,5 @@ module ShaAttribute end end end + +ShaAttribute::ClassMethods.prepend_if_ee('EE::ShaAttribute') diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb index 2a5ae7930e6..583e23d1274 100644 --- a/app/models/container_repository.rb +++ b/app/models/container_repository.rb @@ -96,3 +96,5 @@ class ContainerRepository < ApplicationRecord name: path.repository_name) end end + +ContainerRepository.prepend_if_ee('EE::ContainerRepository') diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index 861185dc222..0b00cf10714 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -173,3 +173,5 @@ class DiffNote < Note noteable.respond_to?(:repository) ? noteable.repository : project.repository end end + +DiffNote.prepend_if_ee('::EE::DiffNote') diff --git a/app/models/discussion_note.rb b/app/models/discussion_note.rb index 142cbdcdfa6..5049107da2c 100644 --- a/app/models/discussion_note.rb +++ b/app/models/discussion_note.rb @@ -4,6 +4,9 @@ # # A note of this type can be resolvable. class DiscussionNote < Note + # This prepend must stay here because the `validates` below depends on it. + prepend_if_ee('EE::DiscussionNote') # rubocop: disable Cop/InjectEnterpriseEditionModule + # Names of all implementers of `Noteable` that support discussions. def self.noteable_types %w(MergeRequest Issue Commit Snippet) diff --git a/app/models/environment.rb b/app/models/environment.rb index 1b53c4b45f9..3d3edcbbe66 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -246,3 +246,5 @@ class Environment < ApplicationRecord self.slug = Gitlab::Slug::Environment.new(name).generate end end + +Environment.prepend_if_ee('EE::Environment') diff --git a/app/models/epic.rb b/app/models/epic.rb index 3693db1de33..46723462590 100644 --- a/app/models/epic.rb +++ b/app/models/epic.rb @@ -15,3 +15,5 @@ class Epic < ApplicationRecord '&' end end + +Epic.prepend_if_ee('EE::Epic') diff --git a/app/models/event.rb b/app/models/event.rb index 580bb770599..205e1f71c74 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -409,3 +409,5 @@ class Event < ApplicationRecord UserInteractedProject.track(self) if UserInteractedProject.available? end end + +Event.prepend_if_ee('EE::Event') diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index 59f5a7703e2..1d553fc8312 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -2,6 +2,7 @@ # Global Milestones are milestones that can be shared across multiple projects class GlobalMilestone include Milestoneish + include_if_ee('::EE::GlobalMilestone') # rubocop: disable Cop/InjectEnterpriseEditionModule STATE_COUNT_HASH = { opened: 0, closed: 0, all: 0 }.freeze diff --git a/app/models/group.rb b/app/models/group.rb index abe93cf3c84..1b62db04ab7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -465,3 +465,5 @@ class Group < Namespace errors.add(:visibility_level, "#{visibility} is not allowed since there are sub-groups with higher visibility.") end end + +Group.prepend_if_ee('EE::Group') diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index 97cb26c6ea9..bfda603c3cb 100644 --- a/app/models/group_milestone.rb +++ b/app/models/group_milestone.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true # Group Milestones are milestones that can be shared among many projects within the same group class GroupMilestone < GlobalMilestone + include_if_ee('::EE::GroupMilestone') # rubocop: disable Cop/InjectEnterpriseEditionModule attr_reader :group, :milestones def self.build_collection(group, projects, params) diff --git a/app/models/hooks/project_hook.rb b/app/models/hooks/project_hook.rb index 18c387f0d34..65e3eaf31e7 100644 --- a/app/models/hooks/project_hook.rb +++ b/app/models/hooks/project_hook.rb @@ -19,3 +19,5 @@ class ProjectHook < WebHook belongs_to :project validates :project, presence: true end + +ProjectHook.prepend_if_ee('EE::ProjectHook') diff --git a/app/models/identity.rb b/app/models/identity.rb index 1cbd50205ed..cb7fd553255 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -47,3 +47,5 @@ class Identity < ApplicationRecord user.user_synced_attributes_metadata&.destroy end end + +Identity.prepend_if_ee('EE::Identity') diff --git a/app/models/identity/uniqueness_scopes.rb b/app/models/identity/uniqueness_scopes.rb index ce68371ae87..c1890865a1c 100644 --- a/app/models/identity/uniqueness_scopes.rb +++ b/app/models/identity/uniqueness_scopes.rb @@ -9,3 +9,5 @@ class Identity < ApplicationRecord end end end + +Identity::UniquenessScopes.prepend_if_ee('EE::Identity::UniquenessScopes') diff --git a/app/models/issue.rb b/app/models/issue.rb index 7c5a139ab55..d0b2165fcc7 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -27,6 +27,7 @@ class Issue < ApplicationRecord belongs_to :project belongs_to :moved_to, class_name: 'Issue' + belongs_to :duplicated_to, class_name: 'Issue' belongs_to :closed_by, class_name: 'User' has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.issues&.maximum(:iid) } @@ -181,6 +182,10 @@ class Issue < ApplicationRecord !moved_to_id.nil? end + def duplicated? + !duplicated_to_id.nil? + end + def can_move?(user, to_project = nil) if to_project return false unless user.can?(:admin_issue, to_project) @@ -293,3 +298,5 @@ class Issue < ApplicationRecord Gitlab::EtagCaching::Store.new.touch(key) end end + +Issue.prepend_if_ee('EE::Issue') diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index fbd9be1fb43..748f73373e3 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -4,3 +4,5 @@ class IssueAssignee < ApplicationRecord belongs_to :issue belongs_to :assignee, class_name: "User", foreign_key: :user_id end + +IssueAssignee.prepend_if_ee('EE::IssueAssignee') diff --git a/app/models/key.rb b/app/models/key.rb index 8aa25924c28..ff601966c26 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -140,3 +140,5 @@ class Key < ApplicationRecord "type is forbidden. Must be #{allowed_types}" end end + +Key.prepend_if_ee('EE::Key') diff --git a/app/models/label.rb b/app/models/label.rb index dc9f0a3d1a9..ea200b4937a 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -272,3 +272,5 @@ class Label < ApplicationRecord %w(color title).each { |attr| self[attr] = self[attr]&.strip } end end + +Label.prepend_if_ee('EE::Label') diff --git a/app/models/label_note.rb b/app/models/label_note.rb index ba5f1f82a81..13a2e1b0c72 100644 --- a/app/models/label_note.rb +++ b/app/models/label_note.rb @@ -103,3 +103,5 @@ class LabelNote < Note events.select { |e| e.action == action }.map(&field) end end + +LabelNote.prepend_if_ee('EE::LabelNote') diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb index e2c75bc7ee9..df1ad8ea281 100644 --- a/app/models/legacy_diff_note.rb +++ b/app/models/legacy_diff_note.rb @@ -111,3 +111,5 @@ class LegacyDiffNote < Note diffs.find { |d| d.new_path == self.diff.new_path } end end + +LegacyDiffNote.prepend_if_ee('EE::LegacyDiffNote') diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 40695a97d97..60b11ad9356 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -42,3 +42,5 @@ class LfsObject < ApplicationRecord Digest::SHA256.file(path).hexdigest end end + +LfsObject.prepend_if_ee('EE::LfsObject') diff --git a/app/models/list.rb b/app/models/list.rb index ae7085f05a7..84c63f3fd6f 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -3,6 +3,8 @@ class List < ApplicationRecord include Importable + prepend_if_ee('::EE::List') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :board belongs_to :label has_many :list_user_preferences diff --git a/app/models/member.rb b/app/models/member.rb index 6457fe9ef0c..e2d26773d45 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -459,3 +459,5 @@ class Member < ApplicationRecord end end end + +Member.prepend_if_ee('EE::Member') diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb index ed5832ff989..bdff9e28df1 100644 --- a/app/models/members/group_member.rb +++ b/app/models/members/group_member.rb @@ -76,3 +76,5 @@ class GroupMember < Member super end end + +GroupMember.prepend_if_ee('EE::GroupMember') diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 2bb5806cd21..68c51860c47 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -146,3 +146,5 @@ class ProjectMember < Member end # rubocop: enable CodeReuse/ServiceClass end + +ProjectMember.prepend_if_ee('EE::ProjectMember') diff --git a/app/models/members_preloader.rb b/app/models/members_preloader.rb index 33855191ca8..1ed0434eacf 100644 --- a/app/models/members_preloader.rb +++ b/app/models/members_preloader.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class MembersPreloader + prepend_if_ee('EE::MembersPreloader') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_reader :members def initialize(members) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 74f8067db0a..90061fe181e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -23,6 +23,8 @@ class MergeRequest < ApplicationRecord SORTING_PREFERENCE_FIELD = :merge_requests_sort + prepend_if_ee('::EE::MergeRequest') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :target_project, class_name: "Project" belongs_to :source_project, class_name: "Project" belongs_to :merge_user, class_name: "User" diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 7f46e5faf1a..4b9fee2bbdf 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -19,6 +19,8 @@ class Milestone < ApplicationRecord include FromUnion include Gitlab::SQL::Pattern + prepend_if_ee('::EE::Milestone') # rubocop: disable Cop/InjectEnterpriseEditionModule + cache_markdown_field :title, pipeline: :single_line cache_markdown_field :description diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 9f9c4288667..9a7c3dc03c3 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -354,3 +354,5 @@ class Namespace < ApplicationRecord end end end + +Namespace.prepend_if_ee('EE::Namespace') diff --git a/app/models/note.rb b/app/models/note.rb index 62b3f47fadd..7a62d70ca5d 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -520,3 +520,5 @@ class Note < ApplicationRecord system_note_metadata&.cross_reference_types&.include?(system_note_metadata&.action) end end + +Note.prepend_if_ee('EE::Note') diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index bf2aec74ec8..981590b688f 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -80,3 +80,5 @@ class NotificationSetting < ApplicationRecord respond_to?(event) && !!public_send(event) # rubocop:disable GitlabSecurity/PublicSend end end + +NotificationSetting.prepend_if_ee('EE::NotificationSetting') diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb index 50eed7344bd..25eab6e4e03 100644 --- a/app/models/pool_repository.rb +++ b/app/models/pool_repository.rb @@ -114,3 +114,5 @@ class PoolRepository < ApplicationRecord .new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX) end end + +PoolRepository.prepend_if_ee('EE::PoolRepository') diff --git a/app/models/project.rb b/app/models/project.rb index 12f5da05efa..04d68d31812 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2331,3 +2331,5 @@ class Project < ApplicationRecord @services_templates ||= Service.where(template: true) end end + +Project.prepend_if_ee('EE::Project') diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb index f95d3ab54e2..e81d9d0f5fe 100644 --- a/app/models/project_authorization.rb +++ b/app/models/project_authorization.rb @@ -2,6 +2,7 @@ class ProjectAuthorization < ApplicationRecord include FromUnion + prepend_if_ee('::EE::ProjectAuthorization') # rubocop: disable Cop/InjectEnterpriseEditionModule belongs_to :user belongs_to :project diff --git a/app/models/project_ci_cd_setting.rb b/app/models/project_ci_cd_setting.rb index 821e022f51b..a495d34c07c 100644 --- a/app/models/project_ci_cd_setting.rb +++ b/app/models/project_ci_cd_setting.rb @@ -36,3 +36,5 @@ class ProjectCiCdSetting < ApplicationRecord self.default_git_depth ||= DEFAULT_GIT_DEPTH end end + +ProjectCiCdSetting.prepend_if_ee('EE::ProjectCiCdSetting') diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index efa3fbcf015..13b20b1fead 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -180,3 +180,5 @@ class ProjectFeature < ApplicationRecord project.team.member?(user, ProjectFeature.required_minimum_access_level(feature)) end end + +ProjectFeature.prepend_if_ee('EE::ProjectFeature') diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index feaf172d48d..0d3a2d4e398 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -52,3 +52,5 @@ class ProjectGroupLink < ApplicationRecord group.refresh_members_authorized_projects end end + +ProjectGroupLink.prepend_if_ee('EE::ProjectGroupLink') diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index 580e8dfd833..87ac6d38787 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -3,6 +3,8 @@ require 'carrierwave/orm/activerecord' class ProjectImportData < ApplicationRecord + prepend_if_ee('::EE::ProjectImportData') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :project, inverse_of: :import_data attr_encrypted :credentials, key: Settings.attr_encrypted_db_key_base, diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index 23adffb33d8..bff00816e15 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -99,3 +99,5 @@ class ProjectImportState < ApplicationRecord Gitlab::SidekiqStatus.set(jid, StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) end end + +ProjectImportState.prepend_if_ee('EE::ProjectImportState') diff --git a/app/models/project_services/chat_message/merge_message.rb b/app/models/project_services/chat_message/merge_message.rb index 6b7a35aaa75..46313ba7bec 100644 --- a/app/models/project_services/chat_message/merge_message.rb +++ b/app/models/project_services/chat_message/merge_message.rb @@ -2,6 +2,8 @@ module ChatMessage class MergeMessage < BaseMessage + prepend_if_ee('::EE::ChatMessage::MergeMessage') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_reader :merge_request_iid attr_reader :source_branch attr_reader :target_branch diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index a69b7b4c4b6..3320405e9e9 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -309,3 +309,5 @@ class HipchatService < Service end end end + +HipchatService.prepend_if_ee('EE::HipchatService') diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index 3a1130ffc15..b6ad46513db 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -146,3 +146,5 @@ class IssueTrackerService < Service end end end + +IssueTrackerService.prepend_if_ee('EE::IssueTrackerService') diff --git a/app/models/project_services/mock_deployment_service.rb b/app/models/project_services/mock_deployment_service.rb index 6f2b0f7747f..f80819de9fb 100644 --- a/app/models/project_services/mock_deployment_service.rb +++ b/app/models/project_services/mock_deployment_service.rb @@ -32,3 +32,5 @@ class MockDeploymentService < Service false end end + +MockDeploymentService.prepend_if_ee('EE::MockDeploymentService') diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index 47999a3694e..b71ed75dde6 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -97,3 +97,5 @@ class ProjectStatistics < ApplicationRecord end end end + +ProjectStatistics.prepend_if_ee('EE::ProjectStatistics') diff --git a/app/models/project_team.rb b/app/models/project_team.rb index aeba2843e5d..de1fc55ba93 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -204,3 +204,5 @@ class ProjectTeam Member.on_project_and_ancestors(project).select(:user_id) end end + +ProjectTeam.prepend_if_ee('EE::ProjectTeam') diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 4a19e05bf76..218be974218 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -225,3 +225,5 @@ class ProjectWiki @project.touch(:last_activity_at, :last_repository_updated_at) end end + +ProjectWiki.prepend_if_ee('EE::ProjectWiki') diff --git a/app/models/prometheus_metric.rb b/app/models/prometheus_metric.rb index c7786500c5c..08f4df7ea01 100644 --- a/app/models/prometheus_metric.rb +++ b/app/models/prometheus_metric.rb @@ -67,3 +67,5 @@ class PrometheusMetric < ApplicationRecord PrometheusMetricEnums.group_details.fetch(group.to_sym) end end + +PrometheusMetric.prepend_if_ee('EE::PrometheusMetric') diff --git a/app/models/prometheus_metric_enums.rb b/app/models/prometheus_metric_enums.rb index d58f825f222..cdd5e2acfce 100644 --- a/app/models/prometheus_metric_enums.rb +++ b/app/models/prometheus_metric_enums.rb @@ -76,3 +76,5 @@ module PrometheusMetricEnums }.freeze end end + +PrometheusMetricEnums.prepend_if_ee('EE::PrometheusMetricEnums') diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 9fd929371f8..8769d3eb916 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -41,3 +41,5 @@ class ProtectedBranch < ApplicationRecord project.protected_branches.select(:name) end end + +ProtectedBranch.prepend_if_ee('EE::ProtectedBranch') diff --git a/app/models/push_event_payload.rb b/app/models/push_event_payload.rb index 537859ec7b7..6a32c480b04 100644 --- a/app/models/push_event_payload.rb +++ b/app/models/push_event_payload.rb @@ -22,3 +22,5 @@ class PushEventPayload < ApplicationRecord tag: 1 } end + +PushEventPayload.prepend_if_ee('EE::PushEventPayload') diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index 41e63986286..c165a1a9b0d 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -304,3 +304,5 @@ class RemoteMirror < ApplicationRecord saved_change_to_url? || saved_change_to_credentials? end end + +RemoteMirror.prepend_if_ee('EE::RemoteMirror') diff --git a/app/models/repository.rb b/app/models/repository.rb index e5a83366776..9d6413c5991 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1172,3 +1172,5 @@ class Repository project.full_path) end end + +Repository.prepend_if_ee('EE::Repository') diff --git a/app/models/resource_label_event.rb b/app/models/resource_label_event.rb index ad08f4763ae..a6aa9ce0e7a 100644 --- a/app/models/resource_label_event.rb +++ b/app/models/resource_label_event.rb @@ -125,3 +125,5 @@ class ResourceLabelEvent < ApplicationRecord [self.class.name, created_at, user_id] end end + +ResourceLabelEvent.prepend_if_ee('EE::ResourceLabelEvent') diff --git a/app/models/service.rb b/app/models/service.rb index d866a51c42e..43ed0c7dfaa 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -352,3 +352,5 @@ class Service < ApplicationRecord activated? && !importing? end end + +Service.prepend_if_ee('EE::Service') diff --git a/app/models/snippet.rb b/app/models/snippet.rb index b2fca65b9e0..273a42e6034 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -227,3 +227,5 @@ class Snippet < ApplicationRecord end end end + +Snippet.prepend_if_ee('EE::Snippet') diff --git a/app/models/system_note_metadata.rb b/app/models/system_note_metadata.rb index a19755d286a..8ec90ca25d3 100644 --- a/app/models/system_note_metadata.rb +++ b/app/models/system_note_metadata.rb @@ -32,3 +32,5 @@ class SystemNoteMetadata < ApplicationRecord TYPES_WITH_CROSS_REFERENCES end end + +SystemNoteMetadata.prepend_if_ee('EE::SystemNoteMetadata') diff --git a/app/models/todo.rb b/app/models/todo.rb index f7f30aed832..aefd9d5ef28 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -207,3 +207,5 @@ class Todo < ApplicationRecord project.repository.keep_around(self.commit_id) end end + +Todo.prepend_if_ee('EE::Todo') diff --git a/app/models/upload.rb b/app/models/upload.rb index ca74f16b3b8..7560002ada8 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -125,3 +125,5 @@ class Upload < ApplicationRecord super&.to_sym end end + +Upload.prepend_if_ee('EE::Upload') diff --git a/app/models/user.rb b/app/models/user.rb index 48acdfeb2ed..c10a4143d1c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1668,3 +1668,5 @@ class User < ApplicationRecord project_creation_level: project_creation_levels) end end + +User.prepend_if_ee('EE::User') diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb index 7b68e5076c7..772170a6b5b 100644 --- a/app/models/user_callout_enums.rb +++ b/app/models/user_callout_enums.rb @@ -18,3 +18,5 @@ module UserCalloutEnums } end end + +UserCalloutEnums.prepend_if_ee('EE::UserCalloutEnums') diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index b236250c24e..a36f56089a0 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -55,3 +55,5 @@ class UserPreference < ApplicationRecord "#{field_key}_notes_filter" end end + +UserPreference.prepend_if_ee('EE::UserPreference') |