Project

General

Profile

Patch #44650 ยป 0001-Skip-issue-update-notifications-for-deleted-issues.patch

Katsuya HIDAKA, 2026-10-21 08:59

View differences:

app/models/mailer.rb
112 112
  # Builds a mail for notifying user about an issue update
113 113
  def issue_edit(user, journal)
114 114
    issue = journal.journalized
115
    return unless issue
116

  
115 117
    redmine_headers 'Project' => issue.project.identifier,
116 118
                    'Issue-Tracker' => issue.tracker.name,
117 119
                    'Issue-Id' => issue.id,
test/unit/mailer_test.rb
575 575
    end
576 576
  end
577 577

  
578
  def test_issue_edit_should_not_send_notification_if_issue_was_deleted_after_journal_was_loaded
579
    journal = Journal.find(1)
580
    issue = Issue.find(journal.journalized_id)
581
    assert_not journal.association(:journalized).loaded?
582

  
583
    issue.destroy!
584
    assert_not Issue.exists?(issue.id)
585
    assert_not Journal.exists?(journal.id)
586

  
587
    assert_no_difference 'ActionMailer::Base.deliveries.size' do
588
      Mailer.issue_edit(User.find(1), journal).deliver_now
589
    end
590
  end
591

  
578 592
  def test_issue_edit_subject_should_include_status_changes_if_setting_is_enabled
579 593
    with_settings :show_status_changes_in_mail_subject => 1 do
580 594
      issue = Issue.find(2)
    (1-1/1)