diff --git a/app/models/keyrelay.rb b/app/models/keyrelay.rb index 0b5483bba..90dc4ef59 100644 --- a/app/models/keyrelay.rb +++ b/app/models/keyrelay.rb @@ -18,14 +18,16 @@ class Keyrelay < ActiveRecord::Base } end - def status + def expiry if expiry_relative - exp_date = pa_date + ISO8601::Duration.new(expiry_relative).to_seconds + pa_date + ISO8601::Duration.new(expiry_relative).to_seconds elsif expiry_absolute - exp_date = expiry_positive + expiry_absolute end + end - if Time.now > exp_date + def status + if Time.now > expiry return 'expired' else return 'pending' diff --git a/app/views/admin/domains/partials/_keyrelays.haml b/app/views/admin/domains/partials/_keyrelays.haml index 96a07e7ec..850abb9f0 100644 --- a/app/views/admin/domains/partials/_keyrelays.haml +++ b/app/views/admin/domains/partials/_keyrelays.haml @@ -6,15 +6,15 @@ %thead %tr %th{class: 'col-xs-4'}= t('uploaded_at') - %th{class: 'col-xs-2'}= t('expiry_relative') - %th{class: 'col-xs-2'}= t('expiry_absolute') + %th{class: 'col-xs-3'}= t('expiry') %th{class: 'col-xs-2'}= t('requester') %th{class: 'col-xs-2'}= t('accepter') + %th{class: 'col-xs-1'}= t('status') %tbody - - @domain.keyrelays.includes([:requester, :accepter]).each do |x| + - @domain.keyrelays.includes([:requester, :accepter]).order(pa_date: :desc).each do |x| %tr %td= link_to(x.pa_date, [:admin, x]) - %td= x.expiry_relative - %td= x.expiry_absolute + %td= x.expiry %td= link_to(x.requester, [:admin, x.requester]) %td= link_to(x.accepter, [:admin, x.accepter]) + %td= x.status diff --git a/app/views/admin/keyrelays/show.haml b/app/views/admin/keyrelays/show.haml index 220e77a20..9b3957c9e 100644 --- a/app/views/admin/keyrelays/show.haml +++ b/app/views/admin/keyrelays/show.haml @@ -16,6 +16,9 @@ %dt= t('domain') %dd= link_to(@keyrelay.domain, [:admin, @keyrelay.domain]) + %dt= t('status') + %dd= @keyrelay.status + %dt= t('flag') %dd= @keyrelay.key_data_flags