Commit 8e0c33ed authored by Alexis Reigel's avatar Alexis Reigel
Browse files

use ShaAttribute for gpg table columns

parent cf19a854577e
class GpgKey < ActiveRecord::Base
KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze
include ShaAttribute
sha_attribute :primary_keyid
sha_attribute :fingerprint
belongs_to :user
has_many :gpg_signatures, dependent: :nullify
......
class GpgSignature < ActiveRecord::Base
include ShaAttribute
sha_attribute :commit_sha
sha_attribute :gpg_key_primary_keyid
belongs_to :project
belongs_to :gpg_key
......
......@@ -6,7 +6,7 @@
= render partial: 'email_with_badge', locals: { email: email, verified: verified }
.description
%code= key.fingerprint
%code= key.fingerprint.upcase
.pull-right
%span.key-created-at
created #{time_ago_with_tooltip(key.created_at)}
......
......@@ -9,7 +9,7 @@
= content
GPG Key ID:
%span.monospace= signature.gpg_key_primary_keyid
%span.monospace= signature.gpg_key_primary_keyid.upcase
= link_to('Learn more about signing commits', help_page_path('workflow/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link')
......
......@@ -7,8 +7,8 @@ def change
t.references :user, index: true, foreign_key: true
t.string :fingerprint
t.string :primary_keyid
t.binary :primary_keyid, limit: Gitlab::Database.mysql? ? 20 : nil
t.binary :fingerprint, limit: Gitlab::Database.mysql? ? 20 : nil
t.text :key
......
......@@ -10,8 +10,9 @@ def change
t.boolean :valid_signature
t.string :commit_sha
t.string :gpg_key_primary_keyid
t.binary :commit_sha, limit: Gitlab::Database.mysql? ? 20 : nil
t.binary :gpg_key_primary_keyid, limit: Gitlab::Database.mysql? ? 20 : nil
t.string :gpg_key_user_name
t.string :gpg_key_user_email
......
......@@ -8,5 +8,9 @@ def up
change_column :snippets, :content, :text, limit: 2147483647
change_column :notes, :st_diff, :text, limit: 2147483647
change_column :events, :data, :text, limit: 2147483647
change_column :gpg_keys, :primary_keyid, :binary, limit: 20
change_column :gpg_keys, :fingerprint, :binary, limit: 20
change_column :gpg_signatures, :commit_sha, :binary, limit: 20
change_column :gpg_signatures, :gpg_key_primary_keyid, :binary, limit: 20
end
end
......@@ -544,8 +544,8 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.string "fingerprint"
t.string "primary_keyid"
t.binary "primary_keyid"
t.binary "fingerprint"
t.text "key"
end
......@@ -558,8 +558,8 @@
t.integer "project_id"
t.integer "gpg_key_id"
t.boolean "valid_signature"
t.string "commit_sha"
t.string "gpg_key_primary_keyid"
t.binary "commit_sha"
t.binary "gpg_key_primary_keyid"
t.string "gpg_key_user_name"
t.string "gpg_key_user_email"
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment