@@ -47,7 +47,7 @@ class Issue < ActiveRecord::Base
47
47
:preload => [ :project , :status , :tracker ] ,
48
48
:scope => lambda { |options | options [ :open_issues ] ? self . open : self . all }
49
49
50
- acts_as_event :title => Proc . new { |o | "#{ o . tracker . name } ##{ o . id } (#{ o . status } ): #{ o . subject } " } ,
50
+ acts_as_event :title => Proc . new { |o | "#{ o . tracker . name } ##{ o . id } (#{ o . event_status } ): #{ o . subject } " } ,
51
51
:url => Proc . new { |o | { :controller => 'issues' , :action => 'show' , :id => o . id } } ,
52
52
:type => Proc . new { |o | 'issue' + ( o . closed? ? '-closed' : '' ) }
53
53
@@ -1452,6 +1452,17 @@ def css_classes(user=User.current)
1452
1452
s
1453
1453
end
1454
1454
1455
+ # Retrieves issue's original status from journal if modified since issue creation
1456
+ # TODO: 書けそうだったらissue_test.rbにテスト追加
1457
+ def event_status
1458
+ changed_statuses = JournalDetail . joins ( "LEFT OUTER JOIN #{ Journal . table_name } ON #{ JournalDetail . table_name } .journal_id = #{ Journal . table_name } .id" ) .
1459
+ where ( "#{ Journal . table_name } .journalized_id = ? AND #{ Journal . table_name } .journalized_type = 'Issue' AND #{ JournalDetail . table_name } .prop_key = 'status_id'" , self . id ) .
1460
+ order ( "#{ Journal . table_name } .created_on" )
1461
+
1462
+ initial_status_id = changed_statuses . first . try ( :old_value )
1463
+ initial_status_id ? IssueStatus . find_by_id ( initial_status_id . to_i ) : self . status
1464
+ end
1465
+
1455
1466
# Unassigns issues from +version+ if it's no longer shared with issue's project
1456
1467
def self . update_versions_from_sharing_change ( version )
1457
1468
# Update issues assigned to the version
0 commit comments