aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-12-05 17:28:23 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-12-05 17:29:02 +0100
commitafa80816370b0d9fa4e4f4272242330f3a2bba6b (patch)
tree34be04de76bdfdc9ddb6943e11db3ee937c9711a
parent935f2dc076af2d24fae9115c06d9a32e25638642 (diff)
downloadsonarqube-afa80816370b0d9fa4e4f4272242330f3a2bba6b.tar.gz
sonarqube-afa80816370b0d9fa4e4f4272242330f3a2bba6b.zip
SONAR-3825 prevent from sharing a measure filter if a system filter has the same name
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb
index b4deac57625..edb7241669b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb
@@ -281,10 +281,10 @@ class MeasureFilter < ActiveRecord::Base
errors.add_to_base('Name already exists') if count>0
if shared
- count = MeasureFilter.count('id', :conditions => ['name=? and shared=? and user_id!=?', name, true, user_id])
- errors.add_to_base('Other users already shared filters with the same name') if count>0
+ count = MeasureFilter.count('id', :conditions => ['name=? and shared=? and (user_id is null or user_id<>?)', name, true, user_id])
+ errors.add_to_base('Other users already share filters with the same name') if count>0
elsif system?
- errors.add_to_base("System filters can't be unshared.")
+ errors.add_to_base("System filters can't be unshared")
end
end
end \ No newline at end of file