closed by field added
This commit is contained in:
parent
56af0631c6
commit
f211e47eb2
4 changed files with 16 additions and 0 deletions
|
@ -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_many :events, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ module Issues
|
|||
end
|
||||
|
||||
if project.issues_enabled? && issue.close
|
||||
issue.update(closed_by: current_user)
|
||||
event_service.close_issue(issue, current_user)
|
||||
create_note(issue, commit) if system_note
|
||||
notification_service.close_issue(issue, current_user) if notifications
|
||||
|
|
13
db/migrate/20180209165249_add_closed_by_to_issues.rb
Normal file
13
db/migrate/20180209165249_add_closed_by_to_issues.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
|
||||
# for more information on how to write migrations for GitLab.
|
||||
|
||||
class AddClosedByToIssues < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
# Set this constant to true if this migration requires downtime.
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :issues, :closed_by_id, :integer
|
||||
end
|
||||
end
|
|
@ -390,6 +390,7 @@ module API
|
|||
|
||||
class IssueBasic < ProjectEntity
|
||||
expose :closed_at
|
||||
expose :closed_by, using: Entities::UserBasic
|
||||
expose :labels do |issue, options|
|
||||
# Avoids an N+1 query since labels are preloaded
|
||||
issue.labels.map(&:title).sort
|
||||
|
|
Loading…
Reference in a new issue