diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gpg/commit.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb index 8bc430db715..6e3f7c28eba 100644 --- a/lib/gitlab/gpg/commit.rb +++ b/lib/gitlab/gpg/commit.rb @@ -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 |