##// END OF EJS Templates
Fixed: error when displaying an issue with a query sorted by an association, eg. priority (#9936)....
Jean-Philippe Lang -
r8449:417219bfc49f
parent child
Show More
@@ -328,7 +328,7 private
328 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
328 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
329 sort_update(@query.sortable_columns, 'issues_index_sort')
329 sort_update(@query.sortable_columns, 'issues_index_sort')
330 limit = 500
330 limit = 500
331 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1))
331 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])
332 if (idx = issue_ids.index(@issue.id)) && idx < limit
332 if (idx = issue_ids.index(@issue.id)) && idx < limit
333 @prev_issue_id = issue_ids[idx - 1] if idx > 0
333 @prev_issue_id = issue_ids[idx - 1] if idx > 0
334 @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
334 @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
@@ -947,6 +947,20 class IssuesControllerTest < ActionController::TestCase
947 assert_tag 'a', :attributes => {:href => '/issues/5'}, :content => /Next/
947 assert_tag 'a', :attributes => {:href => '/issues/5'}, :content => /Next/
948 end
948 end
949
949
950 def test_show_should_display_prev_next_links_with_query_and_sort_on_association
951 @request.session[:query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => nil}
952
953 %w(project tracker status priority author assigned_to category fixed_version).each do |assoc_sort|
954 @request.session['issues_index_sort'] = assoc_sort
955
956 get :show, :id => 3
957 assert_response :success, "Wrong response status for #{assoc_sort} sort"
958
959 assert_tag 'a', :content => /Previous/
960 assert_tag 'a', :content => /Next/
961 end
962 end
963
950 def test_show_should_display_prev_next_links_with_project_query_in_session
964 def test_show_should_display_prev_next_links_with_project_query_in_session
951 @request.session[:query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => 1}
965 @request.session[:query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => 1}
952 @request.session['issues_index_sort'] = 'id'
966 @request.session['issues_index_sort'] = 'id'
General Comments 0
You need to be logged in to leave comments. Login now