summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-20 10:42:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-20 10:42:16 +0000
commit1b002983c31f0936b38d56d2f3d8731f724fc5ef (patch)
treed6a278d4e173b28f658aa3ca636283d353a963ae /app
parent1535ac122053a428ca29f8887cb10994e467f1ab (diff)
downloadredmine-1b002983c31f0936b38d56d2f3d8731f724fc5ef.tar.gz
redmine-1b002983c31f0936b38d56d2f3d8731f724fc5ef.zip
Display the issue status in the email subject only if the status was actually changed.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1079 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/journal.rb5
-rw-r--r--app/models/mailer.rb7
2 files changed, 10 insertions, 2 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 64483d21d..d02067a9d 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -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
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 18fbc96b4..a8566a7a2 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -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)