diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-05 17:28:23 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-05 17:29:02 +0100 |
commit | afa80816370b0d9fa4e4f4272242330f3a2bba6b (patch) | |
tree | 34be04de76bdfdc9ddb6943e11db3ee937c9711a | |
parent | 935f2dc076af2d24fae9115c06d9a32e25638642 (diff) | |
download | sonarqube-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.rb | 6 |
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 |