mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +02:00
Basic history display for eedirekt users
This commit is contained in:
parent
b5608c1394
commit
a426862aa8
6 changed files with 104 additions and 15 deletions
|
@ -48,21 +48,6 @@ class Contact < ActiveRecord::Base
|
|||
CONTACT_TYPE_ADMIN = 'admin'
|
||||
CONTACT_TYPES = [CONTACT_TYPE_TECH, CONTACT_TYPE_ADMIN]
|
||||
|
||||
# TEMP Scope until confusion with contact name is sorted out
|
||||
# scope :named, -> { joins(:international_address).uniq.all }
|
||||
|
||||
# TEMP METHOD for transaction to STI
|
||||
#def address
|
||||
# international_address
|
||||
#end
|
||||
##
|
||||
|
||||
#def presence_of_one_address
|
||||
# return true if local_address || international_address
|
||||
# errors.add(:local_address, 'Local or international address must be present')
|
||||
# errors.add(:international_address, 'Local or international address must be present')
|
||||
#end
|
||||
|
||||
def ident_must_be_valid
|
||||
# TODO: Ident can also be passport number or company registry code.
|
||||
# so have to make changes to validations (and doc/schema) accordingly
|
||||
|
|
|
@ -3,4 +3,30 @@ class ContactVersion < PaperTrail::Version
|
|||
|
||||
self.table_name = :contact_versions
|
||||
self.sequence_name = :contact_version_id_seq
|
||||
|
||||
class << self
|
||||
|
||||
def registrar_events(id)
|
||||
registrar = Registrar.find(id)
|
||||
@events = []
|
||||
registrar.users.each { |user| @events << user_contacts(user.id) }
|
||||
registrar.epp_users.each { |user| @events << user_contacts(user.id) }
|
||||
@events
|
||||
end
|
||||
|
||||
def user_events(id, epp_user_id=nil)
|
||||
contacts = []
|
||||
contacts << user_contacts(id)
|
||||
contacts << epp_user_contacts(epp_user_id) if epp_user_id
|
||||
contacts
|
||||
end
|
||||
|
||||
def user_contacts(id)
|
||||
where(whodunnit: id.to_s)
|
||||
end
|
||||
|
||||
def epp_user_contacts(id)
|
||||
where(whodunnit: "#{id}-EppUser")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue