aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb4
3 files changed, 15 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
index bc4d569dd8d..e9cf723d21d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
@@ -171,7 +171,7 @@ class ResourceController < ApplicationController
@expandable=(@lines!=nil)
@filtered=!@expanded
- conditions='switched_off is not true AND snapshot_id=?'
+ conditions='snapshot_id=?'
values=[@snapshot.id]
unless params[:rule].blank?
severity=Sonar::RulePriority.id(params[:rule])
@@ -194,6 +194,15 @@ class ResourceController < ApplicationController
conditions+=' AND id=-1'
end
end
+
+ if params[:switchedOff]
+ @switchedOff=true
+ conditions+='AND switched_off=?'
+ values<<true
+ else
+ conditions+='AND (switched_off IS NULL OR switched_off=?)'
+ values<<false
+ end
RuleFailure.find(:all, :include => ['rule', 'reviews' ], :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation|
# sorted by severity => from blocker to info
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
index ca8ef32259a..a0efbef1645 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
@@ -199,7 +199,7 @@ class ReviewsController < ApplicationController
def add_all_users ( user_options )
User.find( :all ).each do |user|
userName = user.name
- if current_user.id == user.id
+ if current_user && current_user.id == user.id
userName = "Me (" + user.name + ")"
end
user_options << [userName, user.id.to_s]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
index 7e765102206..e1594d7d441 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
@@ -50,6 +50,10 @@
<% if @display_violations %>
<td class="<%= 'first' if first -%>">
+ <input type="checkbox" value="true" name="switchedOff" id="switchedOff" <%= 'checked' if @switchedOff -%> onclick="applyOptions()"/>
+ <label for="expand">Show only switched-off violations</label>
+ </td>
+ <td class="<%= 'first' if first -%>">
<select id="period" name="period" onchange="applyOptions()">
<option value="">Time changes...</option>
<%= violation_period_select_options(@snapshot, 1) -%>