From b15bec70f8e91f128ff9f1d19a10d2b964bd9cf2 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 25 Nov 2019 09:28:26 +0000 Subject: [PATCH] Don't attempt to render pages for Governments This content is new to the Publishing API, and while I believe Government Frontend is the appropriate place for it to be rendered, I want to put of that decision, and the decisions around how to render it until after the intended changes to history mode have been made, as that's what I'm focusing on. --- app/controllers/content_items_controller.rb | 1 + app/services/presenter_builder.rb | 6 ++++++ 2 files changed, 7 insertions(+) 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