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 ...@@ -52,6 +52,10 @@ module AlertManagement
endpoint_identifier == LEGACY_IDENTIFIER endpoint_identifier == LEGACY_IDENTIFIER
end end
def token_changed?
attribute_changed?(:token)
end
# Blank token assignment triggers token reset # Blank token assignment triggers token reset
def prevent_token_assignment def prevent_token_assignment
if token.present? && token_changed? if token.present? && token_changed?
......
...@@ -247,7 +247,7 @@ module Clusters ...@@ -247,7 +247,7 @@ module Clusters
def prevent_modification def prevent_modification
return if provided_by_user? 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')) errors.add(:base, _('Cannot modify managed Kubernetes cluster'))
return false return false
end end
......
...@@ -188,7 +188,7 @@ class PagesDomain < ApplicationRecord ...@@ -188,7 +188,7 @@ class PagesDomain < ApplicationRecord
def user_provided_key=(key) def user_provided_key=(key)
self.key = key self.key = key
self.certificate_source = 'user_provided' if key_changed? self.certificate_source = 'user_provided' if attribute_changed?(:key)
end end
def user_provided_certificate def user_provided_certificate
...@@ -207,7 +207,7 @@ class PagesDomain < ApplicationRecord ...@@ -207,7 +207,7 @@ class PagesDomain < ApplicationRecord
def gitlab_provided_key=(key) def gitlab_provided_key=(key)
self.key = key self.key = key
self.certificate_source = 'gitlab_provided' if key_changed? self.certificate_source = 'gitlab_provided' if attribute_changed?(:key)
end end
def pages_virtual_domain def pages_virtual_domain
......
...@@ -11,4 +11,8 @@ class AlertsServiceData < ApplicationRecord ...@@ -11,4 +11,8 @@ class AlertsServiceData < ApplicationRecord
mode: :per_attribute_iv, mode: :per_attribute_iv,
key: Settings.attr_encrypted_db_key_base_truncated, key: Settings.attr_encrypted_db_key_base_truncated,
algorithm: 'aes-256-gcm' algorithm: 'aes-256-gcm'
def token_changed?
attribute_changed?(:token)
end
end end
...@@ -308,7 +308,7 @@ class RemoteMirror < ApplicationRecord ...@@ -308,7 +308,7 @@ class RemoteMirror < ApplicationRecord
end end
def mirror_url_changed? def mirror_url_changed?
url_changed? || credentials_changed? url_changed? || attribute_changed?(:credentials)
end end
def saved_change_to_mirror_url? 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