From 9f91e1cae1cd9f9efb2aba5642f73f4eec54fc3a Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 29 Sep 2023 17:22:20 +0100 Subject: [PATCH] Add UK-specific excluded calculated homepage domains Requires https://github.com/mysociety/alaveteli/pull/7836 --- lib/model_patches.rb | 17 +++++++++++++++++ spec/public_body_spec.rb | 15 +++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 spec/public_body_spec.rb diff --git a/lib/model_patches.rb b/lib/model_patches.rb index 5ecdb75d..1c5fa956 100644 --- a/lib/model_patches.rb +++ b/lib/model_patches.rb @@ -73,6 +73,23 @@ def late_calculator prepend ProAccountBans::ModelMethods end + PublicBody.excluded_calculated_home_page_domains += %w[ + aol.co.uk + blueyonder.co.uk + btconnect.com + btinternet.com + btopenworld.com + hotmail.co.uk + live.co.uk + ntlworld.com + sky.com + talk21.com + talktalk.net + tiscali.co.uk + virginmedia.com + yahoo.co.uk + ] + PublicBody.class_eval do # Return the domain part of an email address, canonicalised and with common # extra UK Government server name parts removed. diff --git a/spec/public_body_spec.rb b/spec/public_body_spec.rb new file mode 100644 index 00000000..0fe74519 --- /dev/null +++ b/spec/public_body_spec.rb @@ -0,0 +1,15 @@ +require_relative 'spec_helper' + +RSpec.describe PublicBody do + describe '.excluded_calculated_home_page_domains' do + subject { described_class.excluded_calculated_home_page_domains } + + it 'includes default global domains' do + is_expected.to include('aol.com') + end + + it 'includes expected localise domains' do + is_expected.to include('aol.co.uk') + end + end +end