diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-08-30 13:27:40 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-05 12:18:33 +0200 |
commit | 978252a3fa99414446ce887cd28bf2db5b223d44 (patch) | |
tree | b7e306e89b04ee3d30e35987fe5ecfcdc6b32902 /app/models | |
parent | 31ad752e0688677c0113d4b324c759413858297b (diff) | |
download | gitlab-ce-978252a3fa99414446ce887cd28bf2db5b223d44.tar.gz |
use new #verification_status
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/gpg_key.rb | 13 | ||||
-rw-r--r-- | app/models/gpg_signature.rb | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/app/models/gpg_key.rb b/app/models/gpg_key.rb index 1c1e2b585f0..1633acd4fa9 100644 --- a/app/models/gpg_key.rb +++ b/app/models/gpg_key.rb @@ -82,11 +82,14 @@ class GpgKey < ActiveRecord::Base end def revoke - GpgSignature.where(gpg_key: self, valid_signature: true).update_all( - gpg_key_id: nil, - valid_signature: false, - updated_at: Time.zone.now - ) + GpgSignature + .where(gpg_key: self) + .where.not(verification_status: GpgSignature.verification_statuses[:unknown_key]) + .update_all( + gpg_key_id: nil, + verification_status: GpgSignature.verification_statuses[:unknown_key], + updated_at: Time.zone.now + ) destroy end diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb index 1f047a32c84..4266b1927d8 100644 --- a/app/models/gpg_signature.rb +++ b/app/models/gpg_signature.rb @@ -20,6 +20,14 @@ 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 |