From d86f29b63dc617efc57b81c9305f5420390e061c Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 25 Sep 2012 14:57:28 +0200 Subject: [PATCH] Fix Property --- .../src/main/webapp/WEB-INF/app/models/property.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb index 71481f44ba0..f9e0e4e9fbf 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb @@ -42,7 +42,7 @@ class Property < ActiveRecord::Base prop = by_key(key, resource_id, user_id) if prop all(key, resource_id, user_id).delete_all - Java::OrgSonarServerUi::JRubyFacade.getInstance().setGlobalProperty(key, nil) unless resource_id + setGlobalProperty(key, nil, resource_id, user_id) end end @@ -84,13 +84,13 @@ class Property < ActiveRecord::Base if prop.text_value != text_value prop.text_value = text_value if prop.save - Java::OrgSonarServerUi::JRubyFacade.getInstance().setGlobalProperty(key, text_value) unless resource_id + setGlobalProperty(key, text_value, resource_id, user_id) end end else prop = Property.new(:prop_key => key, :text_value => text_value, :resource_id => resource_id, :user_id => user_id) if prop.save - Java::OrgSonarServerUi::JRubyFacade.getInstance().setGlobalProperty(key, text_value) unless resource_id + setGlobalProperty(key, text_value, resource_id, user_id) end end @@ -130,6 +130,10 @@ class Property < ActiveRecord::Base private + def self.setGlobalProperty(key, value, resource_id, user_id) + Java::OrgSonarServerUi::JRubyFacade.getInstance().setGlobalProperty(key, value) unless (resource_id || user_id) + end + def self.all(key, resource_id=nil, user_id=nil) Property.with_key(key).with_resource(resource_id).with_user(user_id) end -- 2.39.5