diff --git a/app/serializers/client_serializer.rb b/app/serializers/client_serializer.rb index 52469376b..19582fa38 100644 --- a/app/serializers/client_serializer.rb +++ b/app/serializers/client_serializer.rb @@ -48,6 +48,19 @@ class ClientSerializer object.password.present? end + attribute :domains, + if: + Proc.new { |object, params| + params[:current_ability] && + params[:current_ability].can?( + :read_contact_information, + object, + ) == + true + } do |object| + object.domains + end + attribute :contact_email, if: Proc.new { |object, params| diff --git a/app/serializers/repository_serializer.rb b/app/serializers/repository_serializer.rb index 007b2e260..c986c4f07 100644 --- a/app/serializers/repository_serializer.rb +++ b/app/serializers/repository_serializer.rb @@ -43,6 +43,19 @@ class RepositorySerializer object.is_active.getbyte(0) == 1 end + attribute :domains, + if: + Proc.new { |object, params| + params[:current_ability] && + params[:current_ability].can?( + :read_contact_information, + object, + ) == + true + } do |object| + object.domains + end + attribute :has_password, if: Proc.new { |object, params| diff --git a/spec/requests/clients_spec.rb b/spec/requests/clients_spec.rb index fb50a0b96..cc28a63f1 100644 --- a/spec/requests/clients_spec.rb +++ b/spec/requests/clients_spec.rb @@ -297,7 +297,7 @@ before do ProviderPrefix.import - sleep 2 + sleep 3 end it "updates the record" do @@ -332,7 +332,6 @@ ).to eq(client.symbol.downcase) get "provider-prefixes?query=#{prefix.uid}" - puts json expect( json.dig("meta", "total"), ).to eq(1)