allow updating of gpg signature through gpg commit

This commit is contained in:
Alexis Reigel 2017-06-15 14:18:00 +02:00
parent 502e31bec9
commit d48eb77a96

View file

@ -29,6 +29,14 @@ module Gitlab
end
end
def update_signature!(cached_signature)
using_keychain do |gpg_key|
cached_signature.update_attributes!(
valid_signature: self.class.gpg_signature_valid_signature_value(gpg_key, verified_signature)
)
end
end
private
def using_keychain
@ -59,9 +67,13 @@ module Gitlab
project: commit.project,
gpg_key: gpg_key,
gpg_key_primary_keyid: gpg_key&.primary_keyid || verified_signature.fingerprint,
valid_signature: !!(gpg_key && gpg_key.verified? && verified_signature.valid?)
valid_signature: self.class.gpg_signature_valid_signature_value(gpg_key, verified_signature)
)
end
def self.gpg_signature_valid_signature_value(gpg_key, verified_signature_)
!!(gpg_key && gpg_key.verified? && verified_signature_.valid?)
end
end
end
end