]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3404 do not limit search of reviews by default (was 200).
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 11 Apr 2012 17:02:11 +0000 (19:02 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 11 Apr 2012 17:02:11 +0000 (19:02 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb

index 2f339ca64574eb75f5269c273dacb0d2614a1d01..e7ff73455d338fc8a9919b5d8e71ec421c0d9893 100644 (file)
@@ -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
index b6325df13f307a879d5f37a5fcc7fe8f0fba6c87..2342c9eb750a8b79a120f9f848940ae51abe6d77 100644 (file)
@@ -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)
index cac8b35f2af2e29361e6b9aeac6bed2f013fca0f..84dc10032fcea562c7846757195c8d47e1751f36 100644 (file)
@@ -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