aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-15 16:44:25 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-01-16 09:37:45 +0000
commitbbab9afd9952b46b0f395705e06dc43fffb16b15 (patch)
tree0199aee38d00b4ce42077f314b39830ab5f0e201
parent68ba122ede2e5b19f76e671f6cf910d5047686d0 (diff)
Fix error sending `requires_inspection` reports.
has_permission_to() is called in Reports.pm and requires the cobrand to be set on the schema. The test was manually doing this which hid the problem.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm1
-rw-r--r--t/app/sendreport/inspection_required.t3
3 files changed, 2 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f37ca7088..6d863cc9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@
- Fix JavaScript error on /my calculating bounds #1954
- Change text on /reports to match lower down (fix translation).
- Ensure all reports graph can't dip downward. #1956
+ - Fix error sending `requires_inspection` reports. #1961
- UK:
- Lazy load images in the footer.
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index 04ad1c893..aca894d03 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -45,6 +45,7 @@ sub send(;$) {
while (my $row = $unsent->next) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->cobrand)->new();
+ FixMyStreet::DB->schema->cobrand($cobrand);
if ($debug_mode) {
$debug_unsent_count++;
diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t
index 03c7ff944..64d6f70ee 100644
--- a/t/app/sendreport/inspection_required.t
+++ b/t/app/sendreport/inspection_required.t
@@ -5,9 +5,6 @@ use FixMyStreet::Script::Reports;
ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );
-use_ok 'FixMyStreet::Cobrand';
-FixMyStreet::DB->schema->cobrand(FixMyStreet::Cobrand::FixMyStreet->new());
-
my $user = $mech->create_user_ok( 'user@example.com' );
my $body = $mech->create_body_ok( 2237, 'Oxfordshire County Council');