Merged r8865 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.3-stable@9115 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f74e4eddba
commit
f587807f6b
|
@ -390,6 +390,10 @@ class Project < ActiveRecord::Base
|
|||
|
||||
# Returns a scope of the Versions used by the project
|
||||
def shared_versions
|
||||
if new_record?
|
||||
Version.scoped(:include => :project,
|
||||
:conditions => "#{Project.table_name}.status = #{Project::STATUS_ACTIVE} AND #{Version.table_name}.sharing = 'system'")
|
||||
else
|
||||
@shared_versions ||= begin
|
||||
r = root? ? self : root
|
||||
Version.scoped(:include => :project,
|
||||
|
@ -402,6 +406,7 @@ class Project < ActiveRecord::Base
|
|||
"))")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a hash of project users grouped by role
|
||||
def users_by_role
|
||||
|
|
|
@ -586,6 +586,13 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
assert !versions.collect(&:id).include?(6)
|
||||
end
|
||||
|
||||
def test_shared_versions_for_new_project_should_include_system_shared_versions
|
||||
p = Project.find(5)
|
||||
v = Version.create!(:name => 'system_sharing', :project => p, :sharing => 'system')
|
||||
|
||||
assert_include v, Project.new.shared_versions
|
||||
end
|
||||
|
||||
def test_next_identifier
|
||||
ProjectCustomField.delete_all
|
||||
Project.create!(:name => 'last', :identifier => 'p2008040')
|
||||
|
|
Loading…
Reference in New Issue