From: Jean-Philippe Lang Date: Sun, 15 Oct 2017 11:53:49 +0000 (+0000) Subject: Fix filter values for fixed version id (#26667). X-Git-Tag: 4.0.0~498 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cb73fc58f274624b79bacc73f63fcfcfe606e86d;p=redmine.git Fix filter values for fixed version id (#26667). Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@16999 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb index f146a34da..1635b1b15 100644 --- a/app/models/time_entry_query.rb +++ b/app/models/time_entry_query.rb @@ -64,7 +64,7 @@ class TimeEntryQuery < Query add_available_filter("issue.fixed_version_id", :type => :list, :name => l("label_attribute_of_issue", :name => l(:field_fixed_version)), - :values => lambda { fixed_version_values }) if project + :values => lambda { fixed_version_values }) add_available_filter("user_id", :type => :list_optional, :values => lambda { author_values } diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index c61d5f0ea..387f70473 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -581,6 +581,20 @@ class QueriesControllerTest < Redmine::ControllerTest assert_include ["eCookbook - 2.0", "3", "open"], json end + def test_version_filter_time_entries_with_project_id_should_return_filter_values + @request.session[:user_id] = 2 + get :filter, :params => { + :project_id => 1, + :type => 'TimeEntryQuery', + :name => 'issue.fixed_version_id' + } + + assert_response :success + assert_equal 'application/json', response.content_type + json = ActiveSupport::JSON.decode(response.body) + assert_include ["eCookbook - 2.0", "3", "open"], json + end + def test_filter_without_project_id_should_return_filter_values @request.session[:user_id] = 2 get :filter, :params => {