]> source.dussan.org Git - redmine.git/commitdiff
Show the number of days left until the due date in reminders (#31225).
authorGo MAEDA <maeda@farend.jp>
Sun, 19 May 2019 08:52:36 +0000 (08:52 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 19 May 2019 08:52:36 +0000 (08:52 +0000)
Patch by Yuichi HARADA.

git-svn-id: http://svn.redmine.org/redmine/trunk@18174 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/mailer/reminder.html.erb
app/views/mailer/reminder.text.erb
test/unit/mailer_test.rb

index a219e4f51966605357369f939fc94307803ec09a..6f86fcbf8d8df2b439dfc3d335021489a7f6f862 100644 (file)
@@ -2,7 +2,7 @@
 
 <ul>
 <% @issues.each do |issue| -%>
-  <li><%= link_to_issue(issue, :project => true, :only_path => false) %></li>
+  <li><%= link_to_issue(issue, :project => true, :only_path => false) %> (<%= due_date_distance_in_words(issue.due_date) %>)</li>
 <% end -%>
 </ul>
 
index 4954d3a10015dc449417ff375ba19d73ae09d76f..5d38d1ac35ad11b7a1fa643581b5d230ff1c2241 100644 (file)
@@ -1,7 +1,7 @@
 <%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %>:
 
 <% @issues.each do |issue| -%>
-* <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject}" %>
+* <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject} (#{due_date_distance_in_words(issue.due_date)})" %>
 <% end -%>
 
 <%= l(:label_issue_view_all)%> (<%= l(:label_x_open_issues_abbr, :count => @open_issues_count) %>)
index 7b77b8997e07e859dabf638fb21d95e32fbab613..fa3b5516c13627c0dae98488d60e3ccaaa937fe4 100644 (file)
@@ -624,7 +624,7 @@ class MailerTest < ActiveSupport::TestCase
     assert_equal 1, ActionMailer::Base.deliveries.size
     mail = last_email
     assert mail.bcc.include?('dlopper@somenet.foo')
-    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
+    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (5 days late)', mail
     assert_mail_body_match 'View all issues (2 open)', mail
     assert_select_email do
       assert_select 'a[href=?]',
@@ -643,7 +643,7 @@ class MailerTest < ActiveSupport::TestCase
       assert_equal 1, ActionMailer::Base.deliveries.size
       mail = last_email
       assert mail.bcc.include?('dlopper@somenet.foo')
-      assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
+      assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (En retard de 5 jours)', mail
       assert_equal "1 demande(s) arrivent à échéance (42)", mail.subject
     end
   end
@@ -671,7 +671,7 @@ class MailerTest < ActiveSupport::TestCase
     assert_equal 1, ActionMailer::Base.deliveries.size # No mail for dlopper
     mail = last_email
     assert mail.bcc.include?('dlopper@somenet.foo')
-    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
+    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (5 days late)', mail
   end
 
   def test_reminder_should_include_issues_assigned_to_groups
@@ -697,7 +697,7 @@ class MailerTest < ActiveSupport::TestCase
       assert_equal %w(dlopper@somenet.foo jsmith@somenet.foo), recipients
       ActionMailer::Base.deliveries.each do |mail|
         assert_mail_body_match '1 issue(s) that are assigned to you are due in the next 7 days::', mail
-        assert_mail_body_match 'Assigned to group', mail
+        assert_mail_body_match 'Assigned to group (Due in 5 days)', mail
         assert_mail_body_match "View all issues (#{mail.bcc.include?('dlopper@somenet.foo') ? 3 : 2} open)", mail
       end
     end
@@ -748,11 +748,11 @@ class MailerTest < ActiveSupport::TestCase
     assert_equal 1, ActionMailer::Base.deliveries.size
     assert_select_email do
       assert_select 'li', 5
-      assert_select 'li:nth-child(1)', /foo/
-      assert_select 'li:nth-child(2)', /bar/
-      assert_select 'li:nth-child(3)', /baz/
-      assert_select 'li:nth-child(4)', /qux/
-      assert_select 'li:nth-child(5)', /quux/
+      assert_select 'li:nth-child(1)', /foo \(1 day late\)/
+      assert_select 'li:nth-child(2)', /bar \(1 day late\)/
+      assert_select 'li:nth-child(3)', /baz \(Due in 0 days\)/
+      assert_select 'li:nth-child(4)', /qux \(Due in 1 day\)/
+      assert_select 'li:nth-child(5)', /quux \(Due in 2 days\)/
     end
   end