From a7a6abd22aaf9db7fa71176fefe558abde85d716 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 17 Feb 2022 09:40:44 +0800 Subject: [PATCH] fix: add rule for issue expire --- app/models/issue.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index c00f4e767..2a3b95958 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -75,7 +75,7 @@ class Issue < ApplicationRecord scope :issue_index_includes, ->{includes(:tracker, :priority, :version, :issue_status, :journals,:issue_tags,user: :user_extension)} scope :closed, ->{where(status_id: 5)} after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic - after_save :change_versions_count + after_save :change_versions_count, :send_update_message_to_notice_system after_destroy :update_closed_issues_count_in_project!, :decre_project_common, :decre_user_statistic, :decre_platform_statistic def incre_project_common @@ -199,4 +199,8 @@ class Issue < ApplicationRecord self.project.decrement!(:closed_issues_count) if self.status_id == 5 end + def send_update_message_to_notice_system + SendTemplateMessageJob.perform_later('IssueExpire', self.id) if Site.has_notice_menu? && self.due_date == Date.today + 1.days + end + end