Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-29 21:09:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-29 21:09:37 +0300
commit5b2abea8db1916c96027ce3a48e797003316e557 (patch)
tree611bee3c604c65707a4920c051cd18f9ba4d0e0d /app/models
parent09ff71d425b83646eed07d52078111ccbd4b84a9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/namespace.rb10
-rw-r--r--app/models/namespace/admin_note.rb7
-rw-r--r--app/models/project.rb5
-rw-r--r--app/models/project_feature.rb1
4 files changed, 22 insertions, 1 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 7b7c2ea9d7b..eaaf9e3687c 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -46,6 +46,9 @@ class Namespace < ApplicationRecord
has_one :aggregation_schedule, class_name: 'Namespace::AggregationSchedule'
has_one :package_setting_relation, inverse_of: :namespace, class_name: 'PackageSetting'
+ has_one :admin_note, inverse_of: :namespace
+ accepts_nested_attributes_for :admin_note, update_only: true
+
validates :owner, presence: true, unless: ->(n) { n.type == "Group" }
validates :name,
presence: true,
@@ -284,8 +287,13 @@ class Namespace < ApplicationRecord
false
end
+ # Deprecated, use #licensed_feature_available? instead. Remove once Namespace#feature_available? isn't used anymore.
+ def feature_available?(feature)
+ licensed_feature_available?(feature)
+ end
+
# Overridden in EE::Namespace
- def feature_available?(_feature)
+ def licensed_feature_available?(_feature)
false
end
diff --git a/app/models/namespace/admin_note.rb b/app/models/namespace/admin_note.rb
new file mode 100644
index 00000000000..3de809d60be
--- /dev/null
+++ b/app/models/namespace/admin_note.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class Namespace::AdminNote < ApplicationRecord
+ belongs_to :namespace, inverse_of: :admin_note
+ validates :namespace, presence: true
+ validates :note, length: { maximum: 1000 }
+end
diff --git a/app/models/project.rb b/app/models/project.rb
index 61f165b9daa..b21d9818953 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2324,6 +2324,11 @@ class Project < ApplicationRecord
.external_authorization_service_default_label
end
+ # Overridden in EE::Project
+ def licensed_feature_available?(_feature)
+ false
+ end
+
def licensed_features
[]
end
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb
index a598bf3f60c..09a20c3509f 100644
--- a/app/models/project_feature.rb
+++ b/app/models/project_feature.rb
@@ -3,6 +3,7 @@
class ProjectFeature < ApplicationRecord
include Featurable
+ # When updating this array, make sure to update rubocop/cop/gitlab/feature_available_usage.rb as well.
FEATURES = %i[
issues
forking