新增:issue更新者字段
This commit is contained in:
parent
32386c2f66
commit
0c553203c1
|
@ -39,12 +39,14 @@
|
|||
# pm_issue_type :integer
|
||||
# time_scale :decimal(10, 2) default("0.00")
|
||||
# child_count :integer default("0")
|
||||
# changer_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_issues_on_assigned_to_id (assigned_to_id)
|
||||
# index_issues_on_author_id (author_id)
|
||||
# index_issues_on_category_id (category_id)
|
||||
# index_issues_on_changer_id (changer_id)
|
||||
# index_issues_on_created_on (created_on)
|
||||
# index_issues_on_fixed_version_id (fixed_version_id)
|
||||
# index_issues_on_priority_id (priority_id)
|
||||
|
@ -90,6 +92,7 @@ class Issue < ApplicationRecord
|
|||
has_many :attach_pull_requests, through: :pull_attached_issues, source: :pull_request
|
||||
# PM 关联工作项目
|
||||
has_many :pm_links, as: :linkable, dependent: :destroy
|
||||
belongs_to :changer, class_name: 'User', foreign_key: :changer_id, optional: true
|
||||
|
||||
scope :issue_includes, ->{includes(:user)}
|
||||
scope :issue_many_includes, ->{includes(journals: :user)}
|
||||
|
|
|
@ -67,6 +67,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@created_issue.root_id = @root_id
|
||||
@created_issue.time_scale = @time_scale
|
||||
@created_issue.issue_tags_value = @issue_tags.order("id asc").pluck(:id).join(",") unless issue_tag_ids.blank?
|
||||
@created_issue.changer_id = @current_user.id
|
||||
@created_issue.save!
|
||||
|
||||
if Site.has_blockchain? && @project.use_blockchain
|
||||
|
|
|
@ -79,6 +79,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@updated_issue.time_scale = @time_scale unless @time_scale.nil?
|
||||
|
||||
@updated_issue.updated_on = Time.now
|
||||
@updated_issue.changer_id = current_user.id
|
||||
@updated_issue.save!
|
||||
|
||||
build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录
|
||||
|
|
|
@ -33,6 +33,13 @@ json.author do
|
|||
json.nil!
|
||||
end
|
||||
end
|
||||
json.changer do
|
||||
if issue.changer.present?
|
||||
json.partial! "api/v1/users/simple_user", locals: {user: issue.changer}
|
||||
else
|
||||
json.nil!
|
||||
end
|
||||
end
|
||||
json.assigners issue.show_assigners.each do |assigner|
|
||||
json.partial! "api/v1/users/simple_user", locals: {user: assigner}
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddChangerToIssues < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :issues, :changer
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue