-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude email providers from body home pages
Many smaller authorities use a request email address from a general purpose public email provider. We don't want e.g. gmail.com being set as the home page for the authority. This is configurable in the theme by setting the class attribute: # Add to the defaults PublicBody.excluded_calculated_home_page_domains << %w[ example.net ] # Clear the defaults and set your own list PublicBody.excluded_calculated_home_page_domains = %w[ example.org example.net ] Fixes #6434
- Loading branch information
1 parent
864bc90
commit 1cff459
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1905,6 +1905,12 @@ def set_default_attributes(public_body) | |
end | ||
|
||
RSpec.describe PublicBody do | ||
around do |example| | ||
previous = PublicBody.excluded_calculated_home_page_domains | ||
PublicBody.excluded_calculated_home_page_domains = %w[example.net] | ||
example.run | ||
PublicBody.excluded_calculated_home_page_domains = previous | ||
end | ||
|
||
describe 'calculated home page' do | ||
it "returns the home page verbatim if it's present" do | ||
|
@@ -1943,6 +1949,16 @@ def set_default_attributes(public_body) | |
public_body = PublicBody.new(home_page: 'https://example.com') | ||
expect(public_body.calculated_home_page).to eq('https://example.com') | ||
end | ||
|
||
it 'does not calculate the homepage for excluded domains' do | ||
public_body = PublicBody.new(request_email: '[email protected]') | ||
expect(public_body.calculated_home_page).to be_nil | ||
end | ||
|
||
it 'ignores case sensitivity for excluded domains' do | ||
public_body = PublicBody.new(request_email: '[email protected]') | ||
expect(public_body.calculated_home_page).to be_nil | ||
end | ||
end | ||
|
||
describe '#site_administration?' do | ||
|