aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-12-10 16:10:45 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-12-10 16:24:16 +0000
commitfccaeb5bddf034e7e3e35184e8e49748e3a77113 (patch)
treeb2a42d5732e2a0baf3578138d3e060b608ae9d72
parent7c844acae6bbb7f5d64db8d23fb6f01ccb829e5e (diff)
Do not hard code site name in database fixture.
This also lets it be cobrand specific.
-rw-r--r--CHANGELOG.md1
-rwxr-xr-xbin/update-schema1
-rw-r--r--db/downgrade_0070---0069.sql5
-rw-r--r--db/fixture.sql18
-rw-r--r--db/schema_0070-alert-type-site-name.sql5
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm4
-rw-r--r--t/cobrand/tfl.t10
-rw-r--r--templates/email/default/xsl.xsl2
8 files changed, 34 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 441505100..4819a1ef8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,6 +64,7 @@
- Store email addresses report sent to on the report.
- Add configuration for setting Content-Security-Policy header.
- Add banner on staging website/emails.
+ - Do not hard code site name in database fixture.
- Open311 improvements:
- Support use of 'private' service definition <keywords> to mark
reports made in that category private. #2488
diff --git a/bin/update-schema b/bin/update-schema
index 4755142bb..807e144eb 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -212,6 +212,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
+ return '0070' if column_like('alert_type', "ref='new_problems'", 'head_title', '{{SITE_NAME}}');
return '0069' if constraint_contains('admin_log_object_type_check', 'template');
return '0068' if column_exists('users', 'oidc_ids');
return '0067' if table_exists('roles');
diff --git a/db/downgrade_0070---0069.sql b/db/downgrade_0070---0069.sql
new file mode 100644
index 000000000..8e77adec9
--- /dev/null
+++ b/db/downgrade_0070---0069.sql
@@ -0,0 +1,5 @@
+BEGIN;
+
+UPDATE alert_type SET head_title = replace(head_title, '{{SITE_NAME}}', 'FixMyStreet');
+
+COMMIT;
diff --git a/db/fixture.sql b/db/fixture.sql
index 840906223..379353d9f 100644
--- a/db/fixture.sql
+++ b/db/fixture.sql
@@ -26,7 +26,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('new_problems', '', '',
- 'New problems on FixMyStreet', '/', 'The latest problems reported by users',
+ 'New problems on {{SITE_NAME}}', '/', 'The latest problems reported by users',
'problem',
'problem.non_public = ''f'' and problem.state NOT IN
(''unconfirmed'', ''hidden'', ''partial'')',
@@ -40,7 +40,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('new_fixed_problems', '', '',
- 'Problems recently reported fixed on FixMyStreet', '/', 'The latest problems reported fixed by users',
+ 'Problems recently reported fixed on {{SITE_NAME}}', '/', 'The latest problems reported fixed by users',
'problem', 'problem.non_public = ''f'' and problem.state in (''fixed'', ''fixed - user'', ''fixed - council'')', 'lastupdate desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem');
@@ -51,7 +51,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('local_problems', '', '',
- 'New local problems on FixMyStreet', '/', 'The latest local problems reported by users',
+ 'New local problems on {{SITE_NAME}}', '/', 'The latest local problems reported by users',
'problem_find_nearby(?, ?, ?) as nearby,problem',
'nearby.problem_id = problem.id and problem.non_public = ''f'' and problem.state NOT IN
(''unconfirmed'', ''hidden'', ''partial'')',
@@ -65,7 +65,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('local_problems_state', '', '',
- 'New local problems on FixMyStreet', '/', 'The latest local problems reported by users',
+ 'New local problems on {{SITE_NAME}}', '/', 'The latest local problems reported by users',
'problem_find_nearby(?, ?, ?) as nearby,problem', 'nearby.problem_id = problem.id and problem.non_public = ''f'' and problem.state in (?)', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby');
@@ -76,7 +76,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('postcode_local_problems', '', '',
- 'New problems near {{POSTCODE}} on FixMyStreet', '/', 'The latest local problems reported by users',
+ 'New problems near {{POSTCODE}} on {{SITE_NAME}}', '/', 'The latest local problems reported by users',
'problem_find_nearby(?, ?, ?) as nearby,problem',
'nearby.problem_id = problem.id and problem.non_public = ''f'' and problem.state NOT IN
(''unconfirmed'', ''hidden'', ''partial'')',
@@ -90,7 +90,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('postcode_local_problems_state', '', '',
- 'New problems near {{POSTCODE}} on FixMyStreet', '/', 'The latest local problems reported by users',
+ 'New problems near {{POSTCODE}} on {{SITE_NAME}}', '/', 'The latest local problems reported by users',
'problem_find_nearby(?, ?, ?) as nearby,problem', 'nearby.problem_id = problem.id and problem.non_public = ''f'' and problem.state in (?)', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby');
@@ -101,7 +101,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('council_problems', '', '',
- 'New problems to {{COUNCIL}} on FixMyStreet', '/reports', 'The latest problems for {{COUNCIL}} reported by users',
+ 'New problems to {{COUNCIL}} on {{SITE_NAME}}', '/reports', 'The latest problems for {{COUNCIL}} reported by users',
'problem',
'problem.non_public = ''f'' and problem.state NOT IN
(''unconfirmed'', ''hidden'', ''partial'') AND
@@ -117,7 +117,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('ward_problems', '', '',
- 'New problems for {{COUNCIL}} within {{WARD}} ward on FixMyStreet', '/reports',
+ 'New problems for {{COUNCIL}} within {{WARD}} ward on {{SITE_NAME}}', '/reports',
'The latest problems for {{COUNCIL}} within {{WARD}} ward reported by users',
'problem',
'problem.non_public = ''f'' and problem.state NOT IN
@@ -135,7 +135,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('area_problems', '', '',
- 'New problems within {{NAME}}''s boundary on FixMyStreet', '/reports',
+ 'New problems within {{NAME}}''s boundary on {{SITE_NAME}}', '/reports',
'The latest problems within {{NAME}}''s boundary reported by users', 'problem',
'problem.non_public = ''f'' and problem.state NOT IN
(''unconfirmed'', ''hidden'', ''partial'') AND
diff --git a/db/schema_0070-alert-type-site-name.sql b/db/schema_0070-alert-type-site-name.sql
new file mode 100644
index 000000000..70a1337fd
--- /dev/null
+++ b/db/schema_0070-alert-type-site-name.sql
@@ -0,0 +1,5 @@
+BEGIN;
+
+UPDATE alert_type SET head_title = replace(head_title, 'FixMyStreet', '{{SITE_NAME}}');
+
+COMMIT;
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index c418c92b3..55b3088e7 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -302,9 +302,8 @@ sub add_row : Private {
$item{description} .= encode_entities("\n<br>$address") if $address;
}
- my $recipient_name = $c->cobrand->contact_name;
$item{description} .= encode_entities("\n<br><a href='$url'>" .
- sprintf(_("Report on %s"), $recipient_name) . "</a>");
+ sprintf(_("Report on %s"), $c->stash->{site_name}) . "</a>");
if ($row->{latitude} || $row->{longitude}) {
$item{georss} = { point => "$row->{latitude} $row->{longitude}" };
@@ -332,6 +331,7 @@ sub add_parameters : Private {
foreach ( keys %{ $c->stash->{title_params} } ) {
$row->{$_} = $c->stash->{title_params}->{$_};
}
+ $row->{SITE_NAME} = $c->stash->{site_name};
(my $title = _($alert_type->head_title)) =~ s/\{\{(.*?)}}/$row->{$1}/g;
(my $link = $alert_type->head_link) =~ s/\{\{(.*?)}}/$row->{$1}/g;
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index 287a8c98e..69b112323 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -781,6 +781,7 @@ FixMyStreet::override_config {
$staffuser->update;
};
};
+
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'tfl',
MAPIT_URL => 'http://mapit.uk/',
@@ -813,6 +814,15 @@ FixMyStreet::override_config {
$staffuser->unset_extra_metadata('2fa_secret');
$staffuser->update;
};
+
+ subtest 'RSS feed has correct name' => sub {
+ $mech->get_ok('/rss/xsl');
+ $mech->content_contains('RSS feed from the Street Care website');
+ $mech->content_lacks('FixMyStreet');
+ $mech->get_ok('/rss/problems');
+ $mech->content_contains('New problems on Street Care');
+ $mech->content_lacks('FixMyStreet');
+ };
};
FixMyStreet::override_config {
diff --git a/templates/email/default/xsl.xsl b/templates/email/default/xsl.xsl
index ad23b2b3b..09fc9adfe 100644
--- a/templates/email/default/xsl.xsl
+++ b/templates/email/default/xsl.xsl
@@ -12,7 +12,7 @@ email_footer = site_name;
<th style="[% td_style %][% rss_meta_style %]">
<p>
- This is an RSS feed from the FixMyStreet website. RSS feeds allow you
+ This is an RSS feed from the [% site_name %] website. RSS feeds allow you
to stay up to date with the latest changes and additions to the site.
<a href="https://www.bbc.co.uk/news/10628494">Learn more about RSS feeds.</a>
</p>