summaryrefslogtreecommitdiff
path: root/app/models/service.rb
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-10-09 13:20:38 +0300
committerValery Sizov <vsv2711@gmail.com>2015-10-12 13:21:57 +0300
commit07f60552728db7276ad24dafd1ff601ae49442d2 (patch)
tree07032142ee0fa43181dcbc3649890701334c10f7 /app/models/service.rb
parent882bef79e77e0d0bd899c55349f68c3698ce8088 (diff)
downloadgitlab-ce-07f60552728db7276ad24dafd1ff601ae49442d2.tar.gz
Invalidate stored service password if the endpoint URL is changedreset_service_password
Diffstat (limited to 'app/models/service.rb')
-rw-r--r--app/models/service.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/service.rb b/app/models/service.rb
index 60fcc9d2857..7e845d565b1 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -117,6 +117,15 @@ class Service < ActiveRecord::Base
end
end
+ # ActiveRecord does not provide a mechanism to track changes in serialized keys.
+ # This is why we need to perform extra query to do it mannually.
+ def prop_updated?(prop_name)
+ relation_name = self.type.underscore
+ previous_value = project.send(relation_name).send(prop_name)
+ return false if previous_value.nil?
+ previous_value != send(prop_name)
+ end
+
def async_execute(data)
return unless supported_events.include?(data[:object_kind])