Commit 9f72d4e6 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Move EE only codes to their EE modules

parent e258cf31
class AuditEvent < ActiveRecord::Base
prepend EE::AuditEvent
include Gitlab::Utils::StrongMemoize
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
......
......@@ -7,7 +7,6 @@ class LfsObject < ActiveRecord::Base
has_many :projects, through: :lfs_objects_projects
scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::Store::LOCAL]) }
scope :with_files_stored_remotely, -> { where(file_store: LfsObjectUploader::Store::REMOTE) }
validates :oid, presence: true, uniqueness: true
......
......@@ -52,7 +52,6 @@ class Namespace < ActiveRecord::Base
after_commit :refresh_access_of_projects_invited_groups, on: :update, if: -> { previous_changes.key?('share_with_group_lock') }
before_create :sync_share_with_group_lock_with_parent
before_create :sync_membership_lock_with_parent
before_update :sync_share_with_group_lock_with_parent, if: :parent_changed?
after_update :force_share_with_group_lock_on_descendants, if: -> { share_with_group_lock_changed? && share_with_group_lock? }
......@@ -164,10 +163,6 @@ class Namespace < ActiveRecord::Base
Gitlab.config.lfs.enabled
end
def actual_size_limit
Gitlab::CurrentSettings.repository_size_limit
end
def shared_runners_enabled?
projects.with_shared_runners.any?
end
......@@ -297,12 +292,6 @@ class Namespace < ActiveRecord::Base
end
end
def sync_membership_lock_with_parent
if parent&.membership_lock?
self.membership_lock = true
end
end
def force_share_with_group_lock_on_descendants
return unless Group.supports_nested_groups?
......
module EE
module AuditEvent
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
override :author_name
def author_name
details[:author_name].presence || user&.name
end
......
......@@ -10,6 +10,7 @@ module EE
after_destroy :log_geo_event
scope :geo_syncable, -> { with_files_stored_locally }
scope :with_files_stored_remotely, -> { where(file_store: LfsObjectUploader::Store::REMOTE) }
end
private
......
......@@ -37,6 +37,8 @@ module EE
validate :validate_plan_name
validate :validate_shared_runner_minutes_support
before_create :sync_membership_lock_with_parent
end
module ClassMethods
......@@ -102,6 +104,16 @@ module EE
actual_plan&.name || FREE_PLAN
end
def actual_size_limit
::Gitlab::CurrentSettings.repository_size_limit
end
def sync_membership_lock_with_parent
if parent&.membership_lock?
self.membership_lock = true
end
end
def shared_runner_minutes_supported?
if has_parent?
!Feature.enabled?(:shared_runner_minutes_on_root_namespace)
......
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