Commit 4f4d4472 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Fixed: Files without Version aren't visible in the Activity page (#2930).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2569 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 9701c335
......@@ -33,7 +33,7 @@ class Attachment < ActiveRecord::Base
:author_key => :author_id,
:find_options => {:select => "#{Attachment.table_name}.*",
:joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
"LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id"}
"LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id OR ( #{Attachment.table_name}.container_type='Project' AND #{Attachment.table_name}.container_id = #{Project.table_name}.id )"}
acts_as_activity_provider :type => 'documents',
:permission => :view_documents,
......
......@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class ActivityTest < Test::Unit::TestCase
fixtures :projects, :versions, :users, :roles, :members, :issues, :journals, :journal_details,
fixtures :projects, :versions, :attachments, :users, :roles, :members, :issues, :journals, :journal_details,
:trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages
def setup
......@@ -72,6 +72,18 @@ class ActivityTest < Test::Unit::TestCase
assert_nil(events.detect {|e| e.event_author != user})
end
def test_files_activity
f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1))
f.scope = ['files']
events = f.events
assert_kind_of Array, events
assert events.include?(Attachment.find_by_container_type_and_container_id('Project', 1))
assert events.include?(Attachment.find_by_container_type_and_container_id('Version', 1))
assert_equal [Attachment], events.collect(&:class).uniq
assert_equal %w(Project Version), events.collect(&:container_type).uniq.sort
end
private
def find_events(user, options={})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment