diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 20209cdac..cb6c1fbd9 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -7,6 +7,7 @@ class ContentItemsController < ApplicationController rescue_from ActionController::UnknownFormat, with: :error_406 rescue_from PresenterBuilder::RedirectRouteReturned, with: :error_redirect rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound + rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound attr_accessor :content_item, :taxonomy_navigation diff --git a/app/services/presenter_builder.rb b/app/services/presenter_builder.rb index 0423bb081..89b66b992 100644 --- a/app/services/presenter_builder.rb +++ b/app/services/presenter_builder.rb @@ -9,6 +9,7 @@ def initialize(content_item, content_item_path) def presenter raise SpecialRouteReturned if special_route? raise RedirectRouteReturned, content_item if redirect_route? + raise GovernmentReturned if government_content_item? presenter_name.constantize.new(content_item, content_item_path) end @@ -23,6 +24,10 @@ def redirect_route? content_item && content_item["schema_name"] == "redirect" end + def government_content_item? + content_item && content_item["document_type"] == "government" + end + def presenter_name if service_sign_in_format? return service_sign_in_presenter_name @@ -57,4 +62,5 @@ def initialize(content_item) end end class SpecialRouteReturned < StandardError; end + class GovernmentReturned < StandardError; end end