From 0b2db7fd21b6970f91a57bc9ed74352a8e53cad1 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 13 Aug 2013 13:07:17 +0200 Subject: [PATCH] SONAR-4573 Remove the hack which leads do display the 'Project Permissions' page on views even if the property 'hasRolePolicy' is not defined on views --- .../app/controllers/bulk_deletion_controller.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb index 21efff30418..b667d4ccc0a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb @@ -44,8 +44,7 @@ class BulkDeletionController < ApplicationController conditions += " AND projects.enabled=:enabled" values[:enabled] = true - @resources = Project.find(:all, - :select => 'distinct(resource_index.resource_id),projects.id,projects.name,projects.kee,projects.long_name', + @resources = Project.all(:select => 'distinct(resource_index.resource_id),projects.id,projects.name,projects.kee,projects.long_name', :conditions => [conditions, values], :joins => :resource_index) @resources = Api::Utils.insensitive_sort!(@resources){|r| r.name} @@ -61,10 +60,14 @@ class BulkDeletionController < ApplicationController conditions = "scope=:scope AND qualifier IN (:qualifiers) AND status=:status" values = {:scope => 'PRJ', :qualifiers => @tabs} - unprocessed_project_ids = Snapshot.find(:all, :select => 'project_id', :conditions => [conditions, values.merge({:status => Snapshot::STATUS_UNPROCESSED})]).map(&:project_id).uniq - already_processed_project_ids = Snapshot.find(:all, :select => 'project_id', :conditions => [conditions + " AND project_id IN (:pids)", values.merge({:status => Snapshot::STATUS_PROCESSED, :pids => unprocessed_project_ids})]).map(&:project_id).uniq + unprocessed_project_ids = Snapshot.all( + :select => 'project_id', + :conditions => [conditions, values.merge({:status => Snapshot::STATUS_UNPROCESSED})]).map(&:project_id).uniq + already_processed_project_ids = Snapshot.all( + :select => 'project_id', + :conditions => [conditions + " AND project_id IN (:pids)", values.merge({:status => Snapshot::STATUS_PROCESSED, :pids => unprocessed_project_ids})]).map(&:project_id).uniq - @ghosts = Project.find(:all, :conditions => ["id IN (?)", unprocessed_project_ids - already_processed_project_ids]) + @ghosts = Project.all(:conditions => ["id IN (?)", unprocessed_project_ids - already_processed_project_ids]) @ghosts_by_qualifier = {} @ghosts.each do |p| -- 2.39.5