diff options
4 files changed, 10 insertions, 11 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb index bb973147d3e..38e4837bf24 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb @@ -36,7 +36,8 @@ class ProjectReviewsController < ApplicationController if @project access_denied unless has_role?(:user, @project) - found_reviews = Review.search(params) + # 'id' is the id of the project, so it should be removed from the search params + found_reviews = Review.search(params.reject {|k,v| k=='id'}) @reviews = select_authorized(:user, found_reviews, :project) if found_reviews.size != @reviews.size @security_exclusions = true 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 2ca3c693b7e..cac8b35f2af 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 @@ -260,15 +260,13 @@ class Review < ActiveRecord::Base conditions=[] values={} - if options['ids'].present? + if options['id'].present? + conditions << 'id=:id' + values[:id]=options['id'].to_i + elsif options['ids'].present? ids=options['ids'].split(',') - if ids.size > 1 - conditions << 'id in (:ids)' - values[:ids]=ids.map { |id| id.to_i } - else - conditions << 'id=:id' - values[:id]=ids[0].to_i - end + conditions << 'id in (:ids)' + values[:ids]=ids.map { |id| id.to_i } else # --- 'review_type' is deprecated since 2.9 --- diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java index 81d3cc850b0..da420c118a9 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java @@ -267,7 +267,7 @@ public class ReviewQuery extends Query<Review> { StringBuilder url = new StringBuilder(BASE_URL); url.append('?'); if (id != null) { - appendUrlParameter(url, "id", id); + appendUrlParameter(url, "ids", id); } else if (ids != null) { appendUrlParameter(url, "ids", ids); } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java index 5632b29c79a..0186f0ec468 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java @@ -39,7 +39,7 @@ public class ReviewQueryTest extends QueryTestCase { @Test public void queryById() { - assertThat(new ReviewQuery().setId(13L).getUrl(), is("/api/reviews?id=13&")); + assertThat(new ReviewQuery().setId(13L).getUrl(), is("/api/reviews?ids=13&")); assertThat(new ReviewQuery().setIds(10L, 11L).getUrl(), is("/api/reviews?ids=10,11&")); } |