summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-31 20:43:24 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-09-05 12:18:33 +0200
commitb62c1620ea8d4260bb60303d4825a214c7ed56ee (patch)
treeaba652a9e6f1910593775b2b443f9850279cfb29
parentaa98c36e470eb6b11baacac9a27c72ccf3c3a5c6 (diff)
downloadgitlab-ce-b62c1620ea8d4260bb60303d4825a214c7ed56ee.tar.gz
drop backwards compatibility for valid_signature
-rw-r--r--app/models/gpg_signature.rb8
-rw-r--r--lib/gitlab/gpg/invalid_gpg_signature_updater.rb8
-rw-r--r--spec/models/gpg_signature_spec.rb30
3 files changed, 1 insertions, 45 deletions
diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb
index 4266b1927d8..1f047a32c84 100644
--- a/app/models/gpg_signature.rb
+++ b/app/models/gpg_signature.rb
@@ -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
diff --git a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb
index 7bdf6760295..e085eab26c9 100644
--- a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb
+++ b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb
@@ -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
diff --git a/spec/models/gpg_signature_spec.rb b/spec/models/gpg_signature_spec.rb
index d77eeda4a79..c58fd46762a 100644
--- a/spec/models/gpg_signature_spec.rb
+++ b/spec/models/gpg_signature_spec.rb
@@ -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