diff --git a/app/models/attachment.rb b/app/models/attachment.rb index da1fd1c2..67558c53 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -33,7 +33,7 @@ class Attachment < ActiveRecord::Base acts_as_journalized :event_title => :filename, :event_url => (Proc.new do |o| { :controller => 'attachments', :action => 'download', - :id => o.versioned_id, :filename => o.filename } + :id => o.journaled_id, :filename => o.filename } end), :activity_type => 'files', :activity_permission => :view_files, diff --git a/app/models/issue.rb b/app/models/issue.rb index fa92ce1c..151447f3 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -36,7 +36,7 @@ class Issue < ActiveRecord::Base acts_as_customizable acts_as_watchable - acts_as_journalized :event_title => Proc.new {|o| "#{o.tracker.name} ##{o.versioned.id} (#{o.status}): #{o.subject}"}, + acts_as_journalized :event_title => Proc.new {|o| "#{o.tracker.name} ##{o.journaled.id} (#{o.status}): #{o.subject}"}, :event_type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') } register_on_journal_formatter(:id, 'parent_id') diff --git a/app/models/query.rb b/app/models/query.rb index b1f78452..fba15107 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -490,7 +490,7 @@ class Query < ActiveRecord::Base # Returns the journals # Valid options are :order, :offset, :limit def journals(options={}) - Journal.find :all, :include => [:details, :user, {:issue => [:project, :author, :tracker, :status]}], + Journal.find :all, :include => [:user, {:issue => [:project, :author, :tracker, :status]}], :conditions => statement, :order => options[:order], :limit => options[:limit], diff --git a/app/views/issues/changes.rxml b/app/views/issues/changes.rxml index 4c1e678b..696c8006 100644 --- a/app/views/issues/changes.rxml +++ b/app/views/issues/changes.rxml @@ -7,7 +7,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema) xml.author { xml.name "#{Setting.app_title}" } @journals.each do |change| - issue = change.issue + issue = change.journaled xml.entry do xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb index 7214794b..d1868f3a 100644 --- a/lib/redmine/export/pdf.rb +++ b/lib/redmine/export/pdf.rb @@ -280,7 +280,7 @@ module Redmine pdf.SetFontStyle('B',9) pdf.Cell(190,5, l(:label_history), "B") pdf.Ln - for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") + for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_at ASC") pdf.SetFontStyle('B',8) pdf.Cell(190,5, format_time(journal.created_at) + " - " + journal.user.name) pdf.Ln diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 736c033a..d8d9afc2 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -676,9 +676,9 @@ class IssuesControllerTest < ActionController::TestCase :category_id => '1' # no change } end - assert Issue.current_journal.changes.has_key? "subject" - assert Issue.current_journal.changes.has_key? "priority_id" - assert !Issue.current_journal.changes.has_key?("category_id") + assert issue.current_journal.changes.has_key? "subject" + assert issue.current_journal.changes.has_key? "priority_id" + assert !issue.current_journal.changes.has_key?("category_id") assert_redirected_to :action => 'show', :id => '1' issue.reload @@ -704,10 +704,10 @@ class IssuesControllerTest < ActionController::TestCase :custom_field_values => { '2' => 'New custom value' } } end - assert Issue.current_journal.changes.has_key? "subject" - assert Issue.current_journal.changes.has_key? "priority_id" - assert !Issue.current_journal.changes.has_key?("category_id") - assert Issue.current_journal.changes.has_key? "2" + assert issue.current_journal.changes.has_key? "subject" + assert issue.current_journal.changes.has_key? "priority_id" + assert !issue.current_journal.changes.has_key?("category_id") + assert issue.current_journal.changes.has_key? "2" assert_redirected_to :action => 'show', :id => '1' issue.reload @@ -797,7 +797,7 @@ class IssuesControllerTest < ActionController::TestCase j = Issue.find(1).journals.find(:first, :order => 'id DESC') assert j.notes.blank? assert_equal 1, j.details.size - assert_equal 'testfile.txt', j.details.first.value + assert_equal 'testfile.txt', j.details.first.last assert_equal User.anonymous, j.user mail = ActionMailer::Base.deliveries.last @@ -948,7 +948,7 @@ class IssuesControllerTest < ActionController::TestCase assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} issue = Issue.find(1) - journal = issue.journals.find(:first, :order => 'created_on DESC') + journal = issue.journals.find(:first, :order => 'created_at DESC') assert_equal '125', issue.custom_value_for(2).value assert_equal 'Bulk editing', journal.notes assert_equal 1, journal.details.size diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index ddda2069..c4b109bc 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -84,7 +84,7 @@ class WikiControllerTest < ActionController::TestCase :page => 'New page', :content => {:comments => 'Created the page', :text => "h1. New page\n\nThis is a new page", - :version => 0} + :lock_version => 0} assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'New_page' page = Project.find(1).wiki.find_page('New page') assert !page.new_record? @@ -100,7 +100,7 @@ class WikiControllerTest < ActionController::TestCase :page => 'New page', :content => {:comments => 'Created the page', :text => "h1. New page\n\nThis is a new page", - :version => 0}, + :lock_version => 0}, :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} end end diff --git a/test/unit/activity_test.rb b/test/unit/activity_test.rb index 5b334e3b..e8091e9a 100644 --- a/test/unit/activity_test.rb +++ b/test/unit/activity_test.rb @@ -79,8 +79,8 @@ class ActivityTest < ActiveSupport::TestCase assert_kind_of Array, events assert events.include?(Attachment.find_by_container_type_and_container_id('Project', 1).last_journal) assert events.include?(Attachment.find_by_container_type_and_container_id('Version', 1).last_journal) - assert_equal [Attachment], events.collect(&:class).uniq - assert_equal %w(Project Version), events.collect(&:container_type).uniq.sort + assert_equal [Attachment], events.collect(&:journaled).collect(&:class).uniq + assert_equal %w(Project Version), events.collect(&:journaled).collect(&:container_type).uniq.sort end private diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 3689f0e6..6598bc1c 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -171,7 +171,7 @@ class MailerTest < ActiveSupport::TestCase mail = ActionMailer::Base.deliveries.last assert_not_nil mail assert_equal Mailer.message_id_for(journal), mail.message_id - assert_equal Mailer.message_id_for(journal.versioned), mail.references.first.to_s + assert_equal Mailer.message_id_for(journal.journaled), mail.references.first.to_s end def test_message_posted_message_id