summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 12:28:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 12:28:39 +0000
commit94b621a99fd57462a6dd641044f62b7ecb67ccc2 (patch)
treec18a12c0fa40fb566ee263ad0d5b4b60050891ff
parentf2a7f83c82aabe05be6f8ebf0c19c90be6bf8f1d (diff)
downloadredmine-94b621a99fd57462a6dd641044f62b7ecb67ccc2.tar.gz
redmine-94b621a99fd57462a6dd641044f62b7ecb67ccc2.zip
Fixed that reminders are sent for closed issues (#10006).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8690 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/mailer.rb2
-rw-r--r--test/unit/mailer_test.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 20ce65bb3..bd94b9f5b 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -341,7 +341,7 @@ class Mailer < ActionMailer::Base
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
user_ids = options[:users]
- scope = Issue.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" +
+ scope = Issue.open.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" +
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date]
)
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index 20efd057b..042b8c36c 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -439,6 +439,17 @@ class MailerTest < ActiveSupport::TestCase
assert_equal '1 issue(s) due in the next 42 days', mail.subject
end
+ def test_reminders_should_not_include_closed_issues
+ Issue.generate!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :assigned_to_id => 3, :due_date => 5.days.from_now)
+ ActionMailer::Base.deliveries.clear
+
+ Mailer.reminders(:days => 42)
+ assert_equal 1, ActionMailer::Base.deliveries.size
+ mail = ActionMailer::Base.deliveries.last
+ assert mail.bcc.include?('dlopper@somenet.foo')
+ assert !mail.body.include?('Closed issue')
+ end
+
def test_reminders_for_users
Mailer.reminders(:days => 42, :users => ['5'])
assert_equal 0, ActionMailer::Base.deliveries.size # No mail for dlopper