]> source.dussan.org Git - redmine.git/commitdiff
Display the issue status in the email subject only if the status was actually changed.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 20 Jan 2008 10:42:16 +0000 (10:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 20 Jan 2008 10:42:16 +0000 (10:42 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1079 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/journal.rb
app/models/mailer.rb

index 64483d21db246052cd09d2836ce66b1ce4c20729..d02067a9df5c712a8eb6a059ee9a82bf0174d34c 100644 (file)
@@ -44,4 +44,9 @@ class Journal < ActiveRecord::Base
     c = details.detect {|detail| detail.prop_key == 'status_id'}
     (c && c.value) ? IssueStatus.find_by_id(c.value.to_i) : nil
   end
+  
+  def new_value_for(prop)
+    c = details.detect {|detail| detail.prop_key == prop}
+    c ? c.value : nil
+  end
 end
index 18fbc96b402d79c20ec59996933f7c9d5479cb2c..a8566a7a2130b678ae285f68f3ee1e1add3486a0 100644 (file)
@@ -24,7 +24,7 @@ class Mailer < ActionMailer::Base
   
   def issue_add(issue)    
     recipients issue.recipients    
-    subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}"
+    subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
     body :issue => issue,
          :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
   end
@@ -35,7 +35,10 @@ class Mailer < ActionMailer::Base
     recipients issue.recipients
     # Watchers in cc
     cc(issue.watcher_recipients - @recipients)
-    subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}"
+    s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
+    s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
+    s << issue.subject
+    subject s
     body :issue => issue,
          :journal => journal,
          :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)