From a499d688021a5ba9f7cb8dba18bb3dc6b0199073 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 1 Mar 2023 03:46:53 +0000 Subject: [PATCH] Show parent issues in notification email (#34302). Patch by Yuichi HARADA. git-svn-id: https://svn.redmine.org/redmine/trunk@22120 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/issues_helper.rb | 2 +- app/models/issue.rb | 2 ++ test/unit/mailer_test.rb | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 9fcd480a5..9a40b0188 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -445,7 +445,7 @@ module IssuesHelper def email_issue_attributes(issue, user, html) items = [] - %w(author status priority assigned_to category fixed_version start_date due_date).each do |attribute| + %w(author status priority assigned_to category fixed_version start_date due_date parent_issue).each do |attribute| if issue.disabled_core_fields.grep(/^#{attribute}(_id)?$/).empty? attr_value = (issue.send attribute).to_s next if attr_value.blank? diff --git a/app/models/issue.rb b/app/models/issue.rb index 88c808321..a0c2006ad 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1502,6 +1502,8 @@ class Issue < ActiveRecord::Base end end + alias :parent_issue :parent + def set_parent_id self.parent_id = parent_issue_id end diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 99d67423f..07b7d27ae 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -658,7 +658,7 @@ class MailerTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.clear with_settings :notified_events => %w(issue_added) do cf = IssueCustomField.generate! - issue = Issue.generate! + issue = Issue.generate!(:parent => Issue.find(1)) Mailer.deliver_issue_add(issue) assert_not_equal 0, ActionMailer::Base.deliveries.size @@ -667,6 +667,7 @@ class MailerTest < ActiveSupport::TestCase assert_mail_body_match /^\* Author: /, mail assert_mail_body_match /^\* Status: /, mail assert_mail_body_match /^\* Priority: /, mail + assert_mail_body_match /^\* Parent task: /, mail assert_mail_body_no_match /^\* Assignee: /, mail assert_mail_body_no_match /^\* Category: /, mail -- 2.39.5