Commit 98531fc2 authored by Alexis Reigel's avatar Alexis Reigel

upcase in the model instead of in the view

parent f86580c0
...@@ -37,6 +37,14 @@ class GpgKey < ActiveRecord::Base ...@@ -37,6 +37,14 @@ class GpgKey < ActiveRecord::Base
after_commit :update_invalid_gpg_signatures, on: :create after_commit :update_invalid_gpg_signatures, on: :create
after_commit :notify_user, on: :create after_commit :notify_user, on: :create
def primary_keyid
super&.upcase
end
def fingerprint
super&.upcase
end
def key=(value) def key=(value)
value.strip! unless value.blank? value.strip! unless value.blank?
write_attribute(:key, value) write_attribute(:key, value)
......
...@@ -11,6 +11,10 @@ class GpgSignature < ActiveRecord::Base ...@@ -11,6 +11,10 @@ class GpgSignature < ActiveRecord::Base
validates :project, presence: true validates :project, presence: true
validates :gpg_key_primary_keyid, presence: true validates :gpg_key_primary_keyid, presence: true
def gpg_key_primary_keyid
super&.upcase
end
def commit def commit
project.commit(commit_sha) project.commit(commit_sha)
end end
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= render partial: 'email_with_badge', locals: { email: email, verified: verified } = render partial: 'email_with_badge', locals: { email: email, verified: verified }
.description .description
%code= key.fingerprint.upcase %code= key.fingerprint
.pull-right .pull-right
%span.key-created-at %span.key-created-at
created #{time_ago_with_tooltip(key.created_at)} created #{time_ago_with_tooltip(key.created_at)}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= content = content
GPG Key ID: GPG Key ID:
%span.monospace= signature.gpg_key_primary_keyid.upcase %span.monospace= signature.gpg_key_primary_keyid
= link_to('Learn more about signing commits', help_page_path('workflow/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link') = link_to('Learn more about signing commits', help_page_path('workflow/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link')
......
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