Commit 0da7697f authored by Igor Drozdov's avatar Igor Drozdov

Fix 2.7 warnings related to attr_encrypted

Currently, attr_encrypted gem implements dirty attrs
without handling kwargs properly.

If we just replace using attr_changed? method with
calling attribute_changed?(attr), it fixes the warning

It allows us getting away without updating the gem
parent e3aef48b
......@@ -52,6 +52,10 @@ module AlertManagement
endpoint_identifier == LEGACY_IDENTIFIER
end
def token_changed?
attribute_changed?(:token)
end
# Blank token assignment triggers token reset
def prevent_token_assignment
if token.present? && token_changed?
......
......@@ -247,7 +247,7 @@ module Clusters
def prevent_modification
return if provided_by_user?
if api_url_changed? || token_changed? || ca_pem_changed?
if api_url_changed? || attribute_changed?(:token) || ca_pem_changed?
errors.add(:base, _('Cannot modify managed Kubernetes cluster'))
return false
end
......
......@@ -188,7 +188,7 @@ class PagesDomain < ApplicationRecord
def user_provided_key=(key)
self.key = key
self.certificate_source = 'user_provided' if key_changed?
self.certificate_source = 'user_provided' if attribute_changed?(:key)
end
def user_provided_certificate
......@@ -207,7 +207,7 @@ class PagesDomain < ApplicationRecord
def gitlab_provided_key=(key)
self.key = key
self.certificate_source = 'gitlab_provided' if key_changed?
self.certificate_source = 'gitlab_provided' if attribute_changed?(:key)
end
def pages_virtual_domain
......
......@@ -11,4 +11,8 @@ class AlertsServiceData < ApplicationRecord
mode: :per_attribute_iv,
key: Settings.attr_encrypted_db_key_base_truncated,
algorithm: 'aes-256-gcm'
def token_changed?
attribute_changed?(:token)
end
end
......@@ -308,7 +308,7 @@ class RemoteMirror < ApplicationRecord
end
def mirror_url_changed?
url_changed? || credentials_changed?
url_changed? || attribute_changed?(:credentials)
end
def saved_change_to_mirror_url?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment