Merge pull request '工作项部分修改' (#224) from yystopf/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
7994839d96
|
@ -64,6 +64,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
end
|
||||
|
||||
def batch_destroy
|
||||
return render_ok if params[:ids].is_a?(Array) && params[:ids].blank?
|
||||
@object_result = Api::V1::Issues::BatchDeleteService.call(@project, @issues, current_user)
|
||||
if @object_result
|
||||
render_ok
|
||||
|
|
|
@ -15,6 +15,8 @@ class Api::V1::Issues::DeleteService < ApplicationService
|
|||
raise Error, errors.full_messages.join(", ") unless valid?
|
||||
try_lock("Api::V1::Issues::DeleteService:#{project.id}") # 开始写数据,加锁
|
||||
|
||||
delete_be_linkable_issues
|
||||
|
||||
delete_issue
|
||||
|
||||
project.incre_project_issue_cache_delete_count
|
||||
|
@ -38,4 +40,10 @@ class Api::V1::Issues::DeleteService < ApplicationService
|
|||
raise Error, "删除疑修失败!" unless issue.destroy!
|
||||
end
|
||||
|
||||
def delete_be_linkable_issues
|
||||
pmlink_ids = PmLink.where(linkable: issue).pluck(:be_linkable_id)
|
||||
linkable_issues = Issue.where(id: pmlink_ids)
|
||||
raise Error, "删除疑修关联项失败!" unless linkable_issues.destroy_all
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue