From e46d4bf4da3ee207043c85524df238475e47d650 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 28 Mar 2019 14:59:24 +0000 Subject: Extract a Git::{Base,Tag,Branch}HooksService --- app/models/gpg_signature.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/models/gpg_signature.rb') diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb index 7f9ff7bbda6..46cac1d41bb 100644 --- a/app/models/gpg_signature.rb +++ b/app/models/gpg_signature.rb @@ -38,6 +38,15 @@ class GpgSignature < ApplicationRecord .safe_find_or_create_by!(commit_sha: attributes[:commit_sha]) end + # Find commits that are lacking a signature in the database at present + def self.unsigned_commit_shas(commit_shas) + return [] if commit_shas.empty? + + signed = GpgSignature.where(commit_sha: commit_shas).pluck(:commit_sha) + + commit_shas - signed + end + def gpg_key=(model) case model when GpgKey -- cgit v1.2.1