Skip to content

Commit

Permalink
Don't notify Sentry when specialist document is missing finder
Browse files Browse the repository at this point in the history
Fixes https://sentry.io/organizations/govuk/issues/1870942805/events/latest/?project=202226

This code was initially added in 9f39d88,
around 4 years ago, seemingly just being cautious. There's no
evidence it has highlighted any useful problems for us, and
recently the check has become problematic as departments often
publish documents first before making the finder live.

The link would be there in Publishing API, but Publishing API
wouldn't know how to expand it yet as the finder itself isn't
live, so nothing matches its `content_id`.
  • Loading branch information
ChrisBAshton committed Feb 12, 2021
1 parent 50b7b67 commit 329c62d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
11 changes: 1 addition & 10 deletions app/presenters/specialist_document_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,8 @@ def value_or_array_of_values(values)
values.length == 1 ? values.first : values
end

# Finder is a required link that must have 1 item
def finder
parent_finder = content_item.dig("links", "finder", 0)
if parent_finder.nil?
GovukError.notify(
"Finder not found",
extra: { error_message: "Finder not found in #{base_path} content item" },
)
end

parent_finder
content_item.dig("links", "finder", 0)
end

def facets
Expand Down
12 changes: 0 additions & 12 deletions test/presenters/specialist_document_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,6 @@ def example_facet(overrides = {})
assert_equal "1 January 2010", presented_metadata["Facet name"]
end

test "sends an error notification when there is no finder" do
example = schema_item("aaib-reports")
example["links"]["finder"] = []

GovukError.expects(:notify).with(
"Finder not found",
extra: { error_message: "Finder not found in /aaib-reports/aaib-investigation-to-rotorsport-uk-calidus-g-pcpc content item" },
)

present_example(example).important_metadata
end

test "omits first_published_at facet values from `other` section of component parameters to avoid duplicates" do
facets = [
{
Expand Down

0 comments on commit 329c62d

Please sign in to comment.