diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 307897d05..9b22068be 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -182,7 +182,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController def batch_issue_params params.permit( - :status_id, :priority_id, :milestone_id, :pm_sprint_id, :pm_issue_type, :root_id, :target_pm_project_id, :project_id, + :status_id, :priority_id, :milestone_id, :pm_sprint_id, :due_date, :pm_issue_type, :root_id, :target_pm_project_id, :project_id, :issue_tag_ids => [], :assigner_ids => [] ) end diff --git a/app/models/issue.rb b/app/models/issue.rb index b40efefa1..2c1a22d92 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -104,9 +104,16 @@ class Issue < ApplicationRecord scope :closed, ->{where(status_id: 5)} scope :opened, ->{where.not(status_id: 5)} after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic + before_save :check_pm_and_update_due_date after_save :change_versions_count, :send_update_message_to_notice_system, :associate_attachment_container, :generate_uuid after_destroy :update_closed_issues_count_in_project!, :decre_project_common, :decre_user_statistic, :decre_platform_statistic + def check_pm_and_update_due_date + if pm_project_id.present? && status_id.changed? && status_id == 5 + self.due_date = self.due_date || Time.current + end + end + def incre_project_common CacheAsyncSetJob.perform_later('project_common_service', {issues: 1}, self.project_id) end