]> source.dussan.org Git - sonarqube.git/commitdiff
Fix which default project dashboard to display
authorDavid Gageot <david@gageot.net>
Fri, 11 May 2012 09:55:28 +0000 (11:55 +0200)
committerDavid Gageot <david@gageot.net>
Fri, 11 May 2012 09:55:28 +0000 (11:55 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb

index ab2f87e5b34ae5cec787bdeea59f73a0f13fa699..d01a2bd464c6aa87d65b81e802b4597969d73811 100644 (file)
@@ -156,7 +156,7 @@ class DashboardController < ApplicationController
       elsif params[:name]
         @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id=?', params[:name], current_user.id])
       else
-        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.user_id=?', current_user.id], :order => 'order_index ASC')
+        @active=ActiveDashboard.user_dashboards(current_user).find { |a| !a.global? }
       end
     end
 
@@ -167,7 +167,7 @@ class DashboardController < ApplicationController
       elsif params[:name]
         @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id IS NULL', params[:name]])
       else
-        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.user_id IS NULL'], :order => 'order_index ASC')
+        @active=ActiveDashboard.user_dashboards(nil).find { |a| !a.global? }
       end
     end
     @dashboard=(@active ? @active.dashboard : nil)