From 33e32f5ad5407f47d34108fb35ef053a811d06ab Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 21 Apr 2020 12:13:17 +0200 Subject: [PATCH] opt-out showing related-identifiers in api. #482 --- app/controllers/dois_controller.rb | 2 ++ app/serializers/doi_serializer.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index b92e6dece..521f824ab 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -244,6 +244,7 @@ def index options[:params] = { current_ability: current_ability, detail: params[:detail], + composite: params[:composite], affiliation: params[:affiliation], is_collection: options[:is_collection], } @@ -292,6 +293,7 @@ def show options[:params] = { current_ability: current_ability, detail: true, + composite: nil, affiliation: params[:affiliation], } diff --git a/app/serializers/doi_serializer.rb b/app/serializers/doi_serializer.rb index f104b9a36..0dcd355cc 100644 --- a/app/serializers/doi_serializer.rb +++ b/app/serializers/doi_serializer.rb @@ -72,7 +72,7 @@ class DoiSerializer Array.wrap(object.identifiers) end - attribute :related_identifiers do |object| + attribute :related_identifiers, if: Proc.new { |object, params| params && params[:composite].blank? } do |object| Array.wrap(object.related_identifiers) end