From c8278a1e6bca00368405a760b3ab8d0d4c32f146 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 11 Apr 2012 19:02:11 +0200 Subject: [PATCH] SONAR-3404 do not limit search of reviews by default (was 200). --- .../webapp/WEB-INF/app/controllers/api/reviews_controller.rb | 2 +- .../main/webapp/WEB-INF/app/controllers/reviews_controller.rb | 1 + sonar-server/src/main/webapp/WEB-INF/app/models/review.rb | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb index 2f339ca6457..e7ff73455d3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb @@ -40,7 +40,7 @@ class Api::ReviewsController < Api::ApiController # - 'assignees' # def index - reviews=select_authorized(:user, Review.search(params), :project) + reviews=select_authorized(:user, Review.search(params.merge({'limit' => 500})), :project) render_reviews(reviews, params[:output] == 'HTML') end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index b6325df13f3..2342c9eb750 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -313,6 +313,7 @@ class ReviewsController < ApplicationController end options['sort'] = @sort unless @sort.blank? options['asc'] = @asc + options['limit']=500 found_reviews = Review.search(options) @reviews = select_authorized(:user, found_reviews, :project) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb index cac8b35f2af..84dc10032fc 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb @@ -259,6 +259,7 @@ class Review < ActiveRecord::Base def self.search(options={}) conditions=[] values={} + no_need_for_db_request = false if options['id'].present? conditions << 'id=:id' @@ -392,7 +393,7 @@ class Review < ActiveRecord::Base end found_reviews = [] - found_reviews = Review.find(:all, :include => ['review_comments', 'project', 'assignee', 'resource', 'user'], :conditions => [conditions.join(' AND '), values], :order => sort, :limit => 200) unless no_need_for_db_request + found_reviews = Review.find(:all, :include => ['review_comments', 'project', 'assignee', 'resource', 'user'], :conditions => [conditions.join(' AND '), values], :order => sort, :limit => options['limit']) unless no_need_for_db_request found_reviews end -- 2.39.5