Merge pull request #1867 from internetee/fix-registrant-tech-domain-query

Registrant API: Allow tech domain query without tech flag
This commit is contained in:
Timo Võhmar 2021-02-26 17:35:41 +02:00 committed by GitHub
commit ba069f57d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,8 @@ module Api
module V1
module Registrant
class DomainsController < ::Api::V1::Registrant::BaseController
before_action :set_tech_flag, only: [:show]
def index
limit = params[:limit] || 200
offset = params[:offset] || 0
@ -42,6 +44,12 @@ module Api
private
def set_tech_flag
# current_user_domains scope depends on tech flag
# However, if it's not present, tech contact can not see specific domain entry at all.
params.merge!(tech: 'true')
end
def current_user_domains_total_count
current_registrant_user.domains.count
rescue CompanyRegister::NotAvailableError