summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-03-30 15:43:45 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-03-30 15:43:45 +0000
commit7c36e8561c60882e6b0b47c563f7d19f3d6b02a6 (patch)
tree2c833fc39f5a86717ddedf1e5e47cf247daf0f9a /app/models
parent4e8bde967e9beb2d2749bd9d2358adeb895ae2dc (diff)
parentb5987e62ea609b2bb55ab762d074a1fd2642d325 (diff)
downloadgitlab-ce-7c36e8561c60882e6b0b47c563f7d19f3d6b02a6.tar.gz
Merge branch '41967_issue_api_closed_by_info' into 'master'
Add closed by information to issue API See merge request gitlab-org/gitlab-ce!17042
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 7bfc45c1f43..6a94d60c828 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -23,6 +23,7 @@ class Issue < ActiveRecord::Base
belongs_to :project
belongs_to :moved_to, class_name: 'Issue'
+ belongs_to :closed_by, class_name: 'User'
has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.issues&.maximum(:iid) }
@@ -78,6 +79,11 @@ class Issue < ActiveRecord::Base
before_transition any => :closed do |issue|
issue.closed_at = Time.zone.now
end
+
+ before_transition closed: :opened do |issue|
+ issue.closed_at = nil
+ issue.closed_by = nil
+ end
end
class << self