]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6131 Measure drilldown is failing on removed components
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 11 Feb 2015 16:41:09 +0000 (17:41 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 11 Feb 2015 16:49:37 +0000 (17:49 +0100)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/components_controller.rb

index 442f7ab237c327ae603b0dbce9a196455f32b800..620279a51f8b94c29f537f04c53e2f11e29fe88a 100644 (file)
@@ -258,7 +258,7 @@ class ApplicationController < ActionController::Base
 
   def init_resource_for_role(role, resource_param=:id)
     @resource=Project.by_key(params[resource_param])
-    unless @resource
+    unless @resource && @resource.enabled
       flash[:error] = message('dashboard.project_not_found')
       redirect_to :controller => :dashboard, :action => :index
     else
index 760e569a86d3564fb21b4fb8d10ceba555b57ec7..c3fabf78a0d911813f2b1c16f4f92ca7a5bfd166 100644 (file)
 #
 class ComponentsController < ApplicationController
 
+  before_filter :init_resource_for_user_role
+
   helper :metrics, :components
 
   SECTION = Navigation::SECTION_RESOURCE
 
   def index
-    init_resource_for_user_role
     @components_configuration = Sonar::ComponentsConfiguration.new
 
     @snapshots = Snapshot.all(:include => 'project', :conditions => ['snapshots.parent_snapshot_id=?', @snapshot.id])