Commit c6d6b8a7 authored by Yorick Peterse's avatar Yorick Peterse

Move EE specific code out of the Project model

This moves various EE specific lines from the Project model into the
EE::Project module. As a result of these changes, the only EE specific
line is now the `prepend` call to inject the `EE::Project` module.
parent f3971166
...@@ -78,7 +78,6 @@ class Project < ActiveRecord::Base ...@@ -78,7 +78,6 @@ class Project < ActiveRecord::Base
default_value_for :wiki_enabled, gitlab_config_features.wiki default_value_for :wiki_enabled, gitlab_config_features.wiki
default_value_for :snippets_enabled, gitlab_config_features.snippets default_value_for :snippets_enabled, gitlab_config_features.snippets
default_value_for :only_allow_merge_if_all_discussions_are_resolved, false default_value_for :only_allow_merge_if_all_discussions_are_resolved, false
default_value_for :only_mirror_protected_branches, true
add_authentication_token_field :runners_token add_authentication_token_field :runners_token
...@@ -140,7 +139,6 @@ class Project < ActiveRecord::Base ...@@ -140,7 +139,6 @@ class Project < ActiveRecord::Base
# Project services # Project services
has_one :campfire_service has_one :campfire_service
has_one :drone_ci_service has_one :drone_ci_service
has_one :gitlab_slack_application_service
has_one :emails_on_push_service has_one :emails_on_push_service
has_one :pipelines_email_service has_one :pipelines_email_service
has_one :irker_service has_one :irker_service
...@@ -547,14 +545,6 @@ class Project < ActiveRecord::Base ...@@ -547,14 +545,6 @@ class Project < ActiveRecord::Base
.base_and_ancestors(upto: top) .base_and_ancestors(upto: top)
end end
def root_namespace
if namespace.has_parent?
namespace.root_ancestor
else
namespace
end
end
def lfs_enabled? def lfs_enabled?
return namespace.lfs_enabled? if self[:lfs_enabled].nil? return namespace.lfs_enabled? if self[:lfs_enabled].nil?
...@@ -1297,7 +1287,6 @@ class Project < ActiveRecord::Base ...@@ -1297,7 +1287,6 @@ class Project < ActiveRecord::Base
# Expires various caches before a project is renamed. # Expires various caches before a project is renamed.
def expire_caches_before_rename(old_path) def expire_caches_before_rename(old_path)
# TODO: if we start using UUIDs for cache, we don't need to do this HACK anymore
repo = Repository.new(old_path, self) repo = Repository.new(old_path, self)
wiki = Repository.new("#{old_path}.wiki", self) wiki = Repository.new("#{old_path}.wiki", self)
......
...@@ -29,6 +29,7 @@ module EE ...@@ -29,6 +29,7 @@ module EE
has_one :jenkins_service has_one :jenkins_service
has_one :jenkins_deprecated_service has_one :jenkins_deprecated_service
has_one :github_service has_one :github_service
has_one :gitlab_slack_application_service
has_many :approvers, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :approvers, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :approver_groups, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :approver_groups, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
...@@ -91,6 +92,7 @@ module EE ...@@ -91,6 +92,7 @@ module EE
end end
default_value_for :packages_enabled, true default_value_for :packages_enabled, true
default_value_for :only_mirror_protected_branches, true
end end
class_methods do class_methods do
...@@ -560,6 +562,14 @@ module EE ...@@ -560,6 +562,14 @@ module EE
instance.token instance.token
end end
def root_namespace
if namespace.has_parent?
namespace.root_ancestor
else
namespace
end
end
private private
def set_override_pull_mirror_available def set_override_pull_mirror_available
......
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