mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
7bc517530c
9 changed files with 84 additions and 41 deletions
|
@ -17,4 +17,20 @@ module ApplicationHelper
|
|||
"#{contact.ident} [#{contact.ident_country_code} #{contact.ident_type}]"
|
||||
end
|
||||
end
|
||||
|
||||
def creator_link(model)
|
||||
return 'not present' if model.blank?
|
||||
return model.creator if model.creator.is_a? String
|
||||
|
||||
# can be api user or some other user
|
||||
link_to(model.creator, ['admin', model.creator])
|
||||
end
|
||||
|
||||
def updator_link(model)
|
||||
return 'not present' if model.blank?
|
||||
return model.updator if model.updator.is_a? String
|
||||
|
||||
# can be api user or some other user
|
||||
link_to(model.updator, ['admin', model.updator])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,20 +28,24 @@ module Versions
|
|||
return nil if creator_str.blank?
|
||||
|
||||
if creator_str =~ /^\d-api-/
|
||||
ApiUser.find_by(id: creator_str)
|
||||
creator = ApiUser.find_by(id: creator_str)
|
||||
else
|
||||
AdminUser.find_by(id: creator_str)
|
||||
creator = AdminUser.find_by(id: creator_str)
|
||||
end
|
||||
|
||||
creator.present? ? creator : creator_str
|
||||
end
|
||||
|
||||
def updator
|
||||
return nil if updator_str.blank?
|
||||
|
||||
if updator_str =~ /^\d-api-/
|
||||
ApiUser.find_by(id: updator_str)
|
||||
updator = ApiUser.find_by(id: updator_str)
|
||||
else
|
||||
AdminUser.find_by(id: updator_str)
|
||||
updator = AdminUser.find_by(id: updator_str)
|
||||
end
|
||||
|
||||
updator.present? ? updator : updator_str
|
||||
end
|
||||
|
||||
# callbacks
|
||||
|
|
|
@ -116,7 +116,7 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
def generate_auth_info
|
||||
return if @generate_auth_info_disabled
|
||||
self.auth_info = SecureRandom.hex(16)
|
||||
self.auth_info = SecureRandom.hex(11)
|
||||
end
|
||||
|
||||
def disable_generate_auth_info! # needed for testing
|
||||
|
|
|
@ -32,18 +32,15 @@
|
|||
%dd
|
||||
= l(@contact.created_at, format: :short)
|
||||
by
|
||||
= link_to(@contact.creator, [:admin, @contact.creator])
|
||||
= creator_link(@contact)
|
||||
|
||||
%dt= t(:updated)
|
||||
%dd
|
||||
= l(@contact.updated_at, format: :short)
|
||||
by
|
||||
= link_to(@contact.updator, [:admin, @contact.updator])
|
||||
|
||||
= updator_link(@contact)
|
||||
|
||||
%dt= t(:registrar)
|
||||
%dd
|
||||
- if @contact.registrar.present?
|
||||
= link_to(@contact.registrar, admin_registrar_path(@contact.registrar))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue