Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0b890e4b
Commit
0b890e4b
authored
Jun 02, 2021
by
Igor Drozdov
Committed by
Thong Kuah
Jul 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up kwargs deprecation warnings paths
parent
0998b2da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
14 deletions
+30
-14
app/models/alert_management/http_integration.rb
app/models/alert_management/http_integration.rb
+0
-4
config/initializers/attr_encrypted_no_db_connection.rb
config/initializers/attr_encrypted_no_db_connection.rb
+16
-0
spec/deprecation_toolkit_env.rb
spec/deprecation_toolkit_env.rb
+0
-4
spec/initializers/attr_encrypted_no_db_connection_spec.rb
spec/initializers/attr_encrypted_no_db_connection_spec.rb
+14
-6
No files found.
app/models/alert_management/http_integration.rb
View file @
0b890e4b
...
...
@@ -53,10 +53,6 @@ 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?
...
...
config/initializers/attr_encrypted_no_db_connection.rb
View file @
0b890e4b
...
...
@@ -27,6 +27,22 @@ module AttrEncrypted
AttrEncrypted
.
instance_method
(
:attribute_instance_methods_as_symbols
).
bind
(
self
).
call
end
end
protected
# The attr_encrypted gem is not actively maintained
# At the same time it contains the code that raises kwargs deprecation warnings:
# https://github.com/attr-encrypted/attr_encrypted/blob/master/lib/attr_encrypted/adapters/active_record.rb#L65
#
def
attr_encrypted
(
*
attrs
)
super
attr
=
attrs
.
first
redefine_method
(
:"
#{
attr
}
_changed?"
)
do
|**
options
|
attribute_changed?
(
attr
,
**
options
)
end
end
end
end
end
...
...
spec/deprecation_toolkit_env.rb
View file @
0b890e4b
...
...
@@ -55,11 +55,7 @@ module DeprecationToolkitEnv
# one by one
def
self
.
allowed_kwarg_warning_paths
%w[
activerecord-6.0.3.7/lib/active_record/migration.rb
activesupport-6.0.3.7/lib/active_support/cache.rb
activerecord-6.0.3.7/lib/active_record/relation.rb
asciidoctor-2.0.12/lib/asciidoctor/extensions.rb
attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb
gitlab-labkit-0.18.0/lib/labkit/correlation/grpc/client_interceptor.rb
]
end
...
...
spec/initializers/attr_encrypted_no_db_connection_spec.rb
View file @
0b890e4b
...
...
@@ -4,18 +4,20 @@ require 'spec_helper'
RSpec
.
describe
'GitLab monkey-patches to AttrEncrypted'
do
describe
'#attribute_instance_methods_as_symbols_available?'
do
it
'returns false'
do
expect
(
ActiveRecord
::
Base
.
__send__
(
:attribute_instance_methods_as_symbols_available?
)).
to
be_falsy
end
it
'does not define virtual attributes'
do
klass
=
Class
.
new
(
ActiveRecord
::
Base
)
do
let
(
:klass
)
do
Class
.
new
(
ActiveRecord
::
Base
)
do
# We need some sort of table to work on
self
.
table_name
=
'projects'
attr_encrypted
:foo
end
end
it
'returns false'
do
expect
(
ActiveRecord
::
Base
.
__send__
(
:attribute_instance_methods_as_symbols_available?
)).
to
be_falsy
end
it
'does not define virtual attributes'
do
instance
=
klass
.
new
aggregate_failures
do
...
...
@@ -28,5 +30,11 @@ RSpec.describe 'GitLab monkey-patches to AttrEncrypted' do
end
end
end
it
'calls attr_changed? method with kwargs'
do
obj
=
klass
.
new
expect
(
obj
.
foo_changed?
).
to
eq
(
false
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment