Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Don’t send emails for HMCTS content items" #149

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions email_alert_service/models/message_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ def email_alerts_supported?(document)
document_links = document.fetch("links", {})
document_type = document.fetch("document_type")

# Temporarily stop HMCTS-related content items from triggering
# email alerts while their forms are migrated to GOV.UK.
# This will be removed on 21/03/2018.
# This only works if HMCTS is the first organisation, which will
# be the case here.
document_expanded_links = document.fetch("expanded_links", {})
return false if document_expanded_links.dig("organisations", 0, "base_path") ==
"/government/organisations/hm-courts-and-tribunals-service"

contains_supported_attribute?(document_links) \
|| contains_supported_attribute?(document_tags) \
|| whitelisted_document_type?(document_type) \
Expand Down
33 changes: 0 additions & 33 deletions spec/models/message_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@
}
end

let(:hmcts_document) do
{
"base_path" => "path/to-doc",
"title" => "Example title",
"document_type" => "example",
"description" => "example description",
"public_updated_at" => "2014-10-06T13:39:19.000+00:00",
"details" => {
"change_history" => change_history,
"tags" => {
"topics" => ["example topic"]
}
},
"expanded_links" => {
"topics" => ["example-topic-uuid"],
"organisations" => [
{
"base_path" => "/government/organisations/hm-courts-and-tribunals-service"
}
]
}
}
end

def email_was_triggered
expect(mock_email_alert).to have_received(:trigger)
end
Expand Down Expand Up @@ -224,15 +200,6 @@ def message_requeued
end
end

context "organisation is HMCTS" do
it "acknowledges but doesn't trigger the email" do
processor.process(hmcts_document.to_json, properties, delivery_info)

email_was_not_triggered
message_acknowledged
end
end

context "has links but is from a blacklisted publishing application" do
before do
good_document["details"] = { "change_history" => change_history }
Expand Down