summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 15:08:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 15:08:17 +0000
commitc9d79ef3b5b67792e331a4cc8e6325f3b4a04760 (patch)
tree0b7c48c03e5c59362f975c20fcf84635fddd94e6 /app/models
parent1691cbe307f7698b3ee39811278990c43b6751a5 (diff)
downloadgitlab-ce-c9d79ef3b5b67792e331a4cc8e6325f3b4a04760.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/instance_variable.rb5
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/models/event.rb4
-rw-r--r--app/models/resource_milestone_event.rb10
4 files changed, 19 insertions, 2 deletions
diff --git a/app/models/ci/instance_variable.rb b/app/models/ci/instance_variable.rb
index 557f3a63280..89ace3f7ede 100644
--- a/app/models/ci/instance_variable.rb
+++ b/app/models/ci/instance_variable.rb
@@ -13,6 +13,11 @@ module Ci
message: "(%{value}) has already been taken"
}
+ validates :encrypted_value, length: {
+ maximum: 1024,
+ too_long: 'The encrypted value of the provided variable exceeds %{count} bytes. Variables over 700 characters risk exceeding the limit.'
+ }
+
scope :unprotected, -> { where(protected: false) }
after_commit { self.class.invalidate_memory_cache(:ci_instance_variable_data) }
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 2b072b22454..f37525e56e4 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -401,7 +401,7 @@ module Ci
# The `Ci::Stage` contains all up-to date data
# as atomic processing updates all data in-bulk
stages
- elsif Feature.enabled?(:ci_pipeline_persisted_stages, default_enabled: true) && complete?
+ elsif complete?
# The `Ci::Stage` contains up-to date data only for `completed` pipelines
# this is due to asynchronous processing of pipeline, and stages possibly
# not updated inline with processing of pipeline
diff --git a/app/models/event.rb b/app/models/event.rb
index 12b85697690..25d016291a7 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -21,6 +21,7 @@ class Event < ApplicationRecord
LEFT = 9 # User left project
DESTROYED = 10
EXPIRED = 11 # User left project due to expiry
+ APPROVED = 12
ACTIONS = HashWithIndifferentAccess.new(
created: CREATED,
@@ -33,7 +34,8 @@ class Event < ApplicationRecord
joined: JOINED,
left: LEFT,
destroyed: DESTROYED,
- expired: EXPIRED
+ expired: EXPIRED,
+ approved: APPROVED
).freeze
WIKI_ACTIONS = [CREATED, UPDATED, DESTROYED].freeze
diff --git a/app/models/resource_milestone_event.rb b/app/models/resource_milestone_event.rb
index 039f26d8e3f..36068cf508b 100644
--- a/app/models/resource_milestone_event.rb
+++ b/app/models/resource_milestone_event.rb
@@ -9,6 +9,8 @@ class ResourceMilestoneEvent < ResourceEvent
validate :exactly_one_issuable
+ scope :include_relations, -> { includes(:user, milestone: [:project, :group]) }
+
enum action: {
add: 1,
remove: 2
@@ -26,4 +28,12 @@ class ResourceMilestoneEvent < ResourceEvent
def milestone_title
milestone&.title
end
+
+ def milestone_parent
+ milestone&.parent
+ end
+
+ def issuable
+ issue || merge_request
+ end
end