]> source.dussan.org Git - redmine.git/commitdiff
Adds filter for system shared versions on the cross project issue list (#4792).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 10 Feb 2010 21:42:32 +0000 (21:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 10 Feb 2010 21:42:32 +0000 (21:42 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3409 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index 788f34e40dab3b02a4d98597fc897bb85e085dc0..b54d942371c2da7e313ccfec2fd07ddb9cb64c5d 100644 (file)
@@ -210,6 +210,10 @@ class Query < ActiveRecord::Base
       add_custom_fields_filters(@project.all_issue_custom_fields)
     else
       # global filters for cross project issue list
+      system_shared_versions = Version.visible.find_all_by_sharing('system')
+      unless system_shared_versions.empty?
+        @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => system_shared_versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] } }
+      end
       add_custom_fields_filters(IssueCustomField.find(:all, :conditions => {:is_filter => true, :is_for_all => true}))
     end
     @available_filters
index 20447473b3f258dd9d0b6ed1a1f1b4c001255e13..26cba2a5ec27619459c36fea681feeee8240cdaa 100644 (file)
@@ -26,6 +26,13 @@ class QueryTest < ActiveSupport::TestCase
     assert !query.available_filters.has_key?('cf_3')
   end
   
+  def test_system_shared_versions_should_be_available_in_global_queries
+    Version.find(2).update_attribute :sharing, 'system'
+    query = Query.new(:project => nil, :name => '_')
+    assert query.available_filters.has_key?('fixed_version_id')
+    assert query.available_filters['fixed_version_id'][:values].detect {|v| v.last == '2'}
+  end
+  
   def find_issues_with_query(query)
     Issue.find :all,
       :include => [ :assigned_to, :status, :tracker, :project, :priority ],