summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 15:06:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 15:06:50 +0000
commit68d3f33d5194c446812d09f079749ddf56f95378 (patch)
tree9cb521544bf72e420a2986ca2fba512274a020eb /app
parent6a4ffad42050949fcf08e78147575734ae99627e (diff)
downloadgitlab-ce-68d3f33d5194c446812d09f079749ddf56f95378.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/issuable.rb20
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/models/merge_request.rb2
3 files changed, 2 insertions, 22 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 205bf4a5a26..bcb86a33138 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -148,26 +148,6 @@ module Issuable
strip_attributes :title
- # The state_machine gem will reset the value of state_id unless it
- # is a raw attribute passed in here:
- # https://gitlab.com/gitlab-org/gitlab/issues/35746#note_241148787
- #
- # This assumes another initialize isn't defined. Otherwise this
- # method may need to be prepended.
- def initialize(attributes = nil)
- if attributes.is_a?(Hash)
- attr = attributes.symbolize_keys
-
- if attr.key?(:state) && !attr.key?(:state_id)
- value = attr.delete(:state)
- state_id = self.class.available_states[value]
- attributes[:state_id] = state_id if state_id
- end
- end
-
- super(attributes)
- end
-
# We want to use optimistic lock for cases when only title or description are involved
# http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
def locking_enabled?
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 3f3e6b2f31a..7e5a94fc0a1 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -77,7 +77,7 @@ class Issue < ApplicationRecord
attr_spammable :title, spam_title: true
attr_spammable :description, spam_description: true
- state_machine :state_id, initial: :opened do
+ state_machine :state_id, initial: :opened, initialize: false do
event :close do
transition [:opened] => :closed
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index e92042d1056..93234cbdfe1 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -103,7 +103,7 @@ class MergeRequest < ApplicationRecord
super + [:merged, :locked]
end
- state_machine :state_id, initial: :opened do
+ state_machine :state_id, initial: :opened, initialize: false do
event :close do
transition [:opened] => :closed
end