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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
b62c1620
Commit
b62c1620
authored
Aug 31, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drop backwards compatibility for valid_signature
parent
aa98c36e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
45 deletions
+1
-45
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+0
-8
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
+1
-7
spec/models/gpg_signature_spec.rb
spec/models/gpg_signature_spec.rb
+0
-30
No files found.
app/models/gpg_signature.rb
View file @
b62c1620
...
...
@@ -20,14 +20,6 @@ class GpgSignature < ActiveRecord::Base
validates
:project_id
,
presence:
true
validates
:gpg_key_primary_keyid
,
presence:
true
# backwards compatibility: legacy records that weren't migrated to use the
# new `#verification_status` have `#valid_signature` set instead
def
verified?
return
valid_signature
if
verification_status
.
nil?
super
end
def
gpg_key_primary_keyid
super
&
.
upcase
end
...
...
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
View file @
b62c1620
...
...
@@ -6,15 +6,9 @@ module Gitlab
end
def
run
# `OR valid_signature` is for backwards compatibility: legacy records
# that weren't migrated to use the new `#verification_status` have
# `#valid_signature` set instead
GpgSignature
.
select
(
:id
,
:commit_sha
,
:project_id
)
.
where
(
'gpg_key_id IS NULL OR valid_signature = ? OR verification_status <> ?'
,
false
,
GpgSignature
.
verification_statuses
[
:verified
]
)
.
where
(
'gpg_key_id IS NULL OR verification_status <> ?'
,
GpgSignature
.
verification_statuses
[
:verified
])
.
where
(
gpg_key_primary_keyid:
@gpg_key
.
primary_keyid
)
.
find_each
{
|
sig
|
sig
.
gpg_commit
.
update_signature!
(
sig
)
}
end
...
...
spec/models/gpg_signature_spec.rb
View file @
b62c1620
...
...
@@ -25,34 +25,4 @@ RSpec.describe GpgSignature do
gpg_signature
.
commit
end
end
describe
'#verified?'
do
it
'returns true when `verification_status` is not set, but `valid_signature` is true'
do
signature
=
create
:gpg_signature
,
valid_signature:
true
,
verification_status:
nil
expect
(
signature
.
verified?
).
to
be
true
expect
(
signature
.
reload
.
verified?
).
to
be
true
end
it
'returns true when `verification_status` is set to :verified'
do
signature
=
create
:gpg_signature
,
verification_status: :verified
expect
(
signature
.
verified?
).
to
be
true
expect
(
signature
.
reload
.
verified?
).
to
be
true
end
it
'returns false when `verification_status` is set to :unknown_key'
do
signature
=
create
:gpg_signature
,
verification_status: :unknown_key
expect
(
signature
.
verified?
).
to
be
false
expect
(
signature
.
reload
.
verified?
).
to
be
false
end
it
'returns false when `verification_status` is not set, but `valid_signature` is false'
do
signature
=
create
:gpg_signature
,
valid_signature:
false
,
verification_status:
nil
expect
(
signature
.
verified?
).
to
be
false
expect
(
signature
.
reload
.
verified?
).
to
be
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