summaryrefslogtreecommitdiffstats
path: root/app/models/journal.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-08 19:00:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-08 19:00:37 +0000
commitfa95501fe5e8c97de4f5960c4eeecfe70d4455f2 (patch)
tree8a1705ab6dd35f12a28201bfdfc15edbd55a4503 /app/models/journal.rb
parenta069c4afcfc5a78853155f43dc1ae7df67c96c87 (diff)
downloadredmine-fa95501fe5e8c97de4f5960c4eeecfe70d4455f2.tar.gz
redmine-fa95501fe5e8c97de4f5960c4eeecfe70d4455f2.zip
Added issues status changes on the activity view (initial patch by Cyril Mougel).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@892 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/journal.rb')
-rw-r--r--app/models/journal.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 331d7a729..64483d21d 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -29,12 +29,19 @@ class Journal < ActiveRecord::Base
:project_key => "#{Issue.table_name}.project_id",
:date_column => "#{Issue.table_name}.created_on"
- acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id}: #{o.issue.subject}"},
+ acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id}: #{o.issue.subject}" + ((s = o.new_status) ? " (#{s})" : '') },
:description => :notes,
+ :author => :user,
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id}}
def save
# Do not save an empty journal
(details.empty? && notes.blank?) ? false : super
end
+
+ # Returns the new status if the journal contains a status change, otherwise nil
+ def new_status
+ c = details.detect {|detail| detail.prop_key == 'status_id'}
+ (c && c.value) ? IssueStatus.find_by_id(c.value.to_i) : nil
+ end
end