mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +02:00
Merge pull request #1527 from internetee/fix-registrant-contact-view
Registrant: Allow to view other contacts of domain
This commit is contained in:
commit
3d30469db9
5 changed files with 76 additions and 28 deletions
|
@ -3,9 +3,10 @@ class Registrant::ContactsController < RegistrantController
|
|||
helper_method :fax_enabled?
|
||||
helper_method :domain_filter_params
|
||||
skip_authorization_check only: %i[edit update]
|
||||
before_action :set_contact, only: [:show]
|
||||
|
||||
def show
|
||||
@contact = current_user_contacts.find(params[:id])
|
||||
@requester_contact = Contact.find_by(ident: current_registrant_user.ident).id
|
||||
authorize! :read, @contact
|
||||
end
|
||||
|
||||
|
@ -30,6 +31,13 @@ class Registrant::ContactsController < RegistrantController
|
|||
|
||||
private
|
||||
|
||||
def set_contact
|
||||
id = params[:id]
|
||||
contact = domain.contacts.find_by(id: id) || current_user_contacts.find_by(id: id)
|
||||
contact ||= Contact.find_by(id: id, ident: domain.registrant.ident)
|
||||
@contact = contact
|
||||
end
|
||||
|
||||
def domain
|
||||
current_user_domains.find(params[:domain_id])
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue