aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/.gitignore2
-rw-r--r--conf/general.yml-example3
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm7
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm17
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm2
-rw-r--r--perllib/FixMyStreet/TestAppProve.pm17
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm1
-rw-r--r--t/cobrand/zurich.t3
-rw-r--r--templates/web/base/admin/config_page.html1
-rw-r--r--templates/web/base/open311/index.html5
-rw-r--r--templates/web/base/report/new/fill_in_details.html2
-rw-r--r--templates/web/fixamingata/open311/index.html5
12 files changed, 47 insertions, 18 deletions
diff --git a/conf/.gitignore b/conf/.gitignore
index 6e77101a1..86ecc7e03 100644
--- a/conf/.gitignore
+++ b/conf/.gitignore
@@ -1,6 +1,6 @@
/general.yml
/general.yml.deployed
-/general.test-autogenerated.yml
+/general.test-autogenerated*.yml
/httpd.conf
/httpd.conf.deployed
/crontab
diff --git a/conf/general.yml-example b/conf/general.yml-example
index aa8d431be..4c89cfba2 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -159,8 +159,9 @@ ALLOWED_COBRANDS:
# the admin interface. Defaults to BASE_URL with "/admin" on the end.
ADMIN_BASE_URL: ''
-# How many items are returned in the GeoRSS feeds by default
+# How many items are returned in the GeoRSS and Open311 feeds by default
RSS_LIMIT: '20'
+OPEN311_LIMIT: 1000
# How many reports to show per page on the All Reports pages
ALL_REPORTS_PER_PAGE: 100
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index 4f1727b1a..98e5f42b2 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -112,7 +112,7 @@ sub get_discovery : Private {
'changeset' => [$prod_changeset],
# XXX rewrite to match
'key_service' => ["Read access is open to all according to our \u003Ca href='/open_data' target='_blank'\u003Eopen data license\u003C/a\u003E. For write access either: 1. return the 'guid' cookie on each call (unique to each client) or 2. use an api key from a user account which can be generated here: http://seeclickfix.com/register The unversioned url will always point to the latest supported version."],
- 'max_requests' => [ $c->config->{RSS_LIMIT} ],
+ 'max_requests' => [ $c->config->{OPEN311_LIMIT} || 1000 ],
'endpoints' => [
{
'endpoint' => [
@@ -205,8 +205,9 @@ sub get_services : Private {
sub output_requests : Private {
my ( $self, $c, $criteria, $limit ) = @_;
- $limit = $c->config->{RSS_LIMIT}
- unless $limit && $limit <= $c->config->{RSS_LIMIT};
+ my $default_limit = $c->config->{OPEN311_LIMIT} || 1000;
+ $limit = $default_limit
+ unless $limit && $limit <= $default_limit;
my $attr = {
order_by => { -desc => 'confirmed' },
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 92865ace9..13a9c52cd 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -924,18 +924,29 @@ sub static_map {
if ($tile_url =~ m{^//}) {
$tile_url = "https:$tile_url";
}
- my $tile = LWP::Simple::get($tile_url);
+ my $tile;
+ if (FixMyStreet->test_mode) {
+ $tile = FixMyStreet->path_to('t/app/controller/sample.jpg')->slurp(iomode => '<:raw');
+ } else {
+ $tile = LWP::Simple::get($tile_url);
+ }
+ next unless $tile;
my $im = Image::Magick->new;
$im->BlobToImage($tile);
+ my $gravity = ($i<2?'North':'South') . ($i%2?'East':'West');
if (!$image) {
$image = $im;
- $image->Extent(geometry => '512x512', gravity => 'NorthWest');
+ $image->Extent(geometry => '512x512', gravity => $gravity);
} else {
- my $gravity = ($i<2?'North':'South') . ($i%2?'East':'West');
$image->Composite(image => $im, gravity => $gravity);
}
}
+ unless ($image) {
+ FixMyStreet::Map::set_map_class($orig_map_class) if $orig_map_class;
+ return;
+ }
+
# The only pin might be the report pin, with added x/y
my $pin = $map_data->{pins}->[0];
if ($pin) {
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index 91f5cd6ef..65183c09c 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -83,6 +83,8 @@ sub send() {
# this is for the new_updates alerts
next if $row->{non_public} and $row->{user_id} != $row->{alert_user_id};
+ next unless FixMyStreet::DB::Result::Problem::visible_states()->{$row->{state}};
+
$schema->resultset('AlertSent')->create( {
alert_id => $row->{alert_id},
parameter => $row->{item_id},
diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm
index 75e9fe0a4..f2584fc33 100644
--- a/perllib/FixMyStreet/TestAppProve.pm
+++ b/perllib/FixMyStreet/TestAppProve.pm
@@ -2,6 +2,8 @@ use strict; use warnings;
package FixMyStreet::TestAppProve;
use App::Prove;
+use sigtrap qw(handler signal_handler normal-signals);
+
use YAML ();
use Path::Tiny 'path';
use Test::PostgreSQL;
@@ -18,6 +20,19 @@ see bin/run-tests for usage
=cut
+sub cleanup {
+ unlink "conf/general.test-autogenerated.$$.yml";
+}
+
+sub signal_handler {
+ cleanup();
+ exit(0);
+}
+
+END {
+ cleanup();
+}
+
sub run {
my ($class, @args) = @_;
local @ARGV = @args;
@@ -71,7 +86,7 @@ sub run {
$config->{FMS_DB_PASS} = '';
}
- my $config_out = 'general.test-autogenerated';
+ my $config_out = "general.test-autogenerated.$$";
path("conf/$config_out.yml")->spew( YAML::Dump($config) );
local $ENV{FMS_OVERRIDE_CONFIG} = $config_out;
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index 921b2996d..0751092fb 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -103,6 +103,7 @@ sub update_comments {
$problem = $self->schema->resultset('Problem')->to_body($body)->search( $criteria );
if (my $p = $problem->first) {
+ next unless defined $request->{update_id} && defined $request->{description};
my $c = $p->comments->search( { external_id => $request->{update_id} } );
if ( !$c->first ) {
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index f1540e2b8..53d8dba0f 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -115,6 +115,7 @@ my @reports = $mech->create_problems_for_body( 1, $division->id, 'Test', {
confirmed => undef,
cobrand => 'zurich',
photo => $sample_photo,
+ areas => ',423017,',
});
my $report = $reports[0];
@@ -482,6 +483,7 @@ $mech->clear_emails_ok;
confirmed => undef,
cobrand => 'zurich',
photo => $sample_photo,
+ areas => ',423017,',
});
$report = $reports[0];
@@ -523,6 +525,7 @@ $mech->email_count_is(0);
confirmed => undef,
cobrand => 'zurich',
photo => $sample_photo,
+ areas => ',423017,',
});
$report = $reports[0];
diff --git a/templates/web/base/admin/config_page.html b/templates/web/base/admin/config_page.html
index 71c524fb3..67661c597 100644
--- a/templates/web/base/admin/config_page.html
+++ b/templates/web/base/admin/config_page.html
@@ -68,6 +68,7 @@ running version <strong>[% git_version || 'unknown' %]</strong>.
</tr>
[% INCLUDE with_cobrand value="ALL_REPORTS_PER_PAGE" cob=c.cobrand.reports_per_page %]
[% INCLUDE just_value value="RSS_LIMIT" %]
+[% INCLUDE just_value value="OPEN311_LIMIT" conf_default = '<em>1000</em>' %]
[% INCLUDE just_value value="AREA_LINKS_FROM_PROBLEMS" %]
[% INCLUDE subsection heading="Geocoder" %]
diff --git a/templates/web/base/open311/index.html b/templates/web/base/open311/index.html
index 196cf0db6..558c14ca5 100644
--- a/templates/web/base/open311/index.html
+++ b/templates/web/base/open311/index.html
@@ -73,7 +73,7 @@ for council problem-reporting systems.</p>
<li><a rel="nofollow" href="http://wiki.open311.org/GeoReport_v2">[% loc('Open311 specification') %]</a></li>
</ul>
-<p>[% tprintf( loc('At most %d requests are returned in each query. The returned requests are ordered by requested_datetime, so to get all requests, do several searches with rolling start_date and end_date.'), c.config.RSS_LIMIT ) %]</p>
+<p>[% tprintf( loc('At most %d requests are returned in each query. The returned requests are ordered by requested_datetime, so to get all requests, do several searches with rolling start_date and end_date.'), c.config.OPEN311_LIMIT ) %]</p>
<p>[% loc('The following Open311 v2 attributes are returned for each request: service_request_id, description, lat, long, media_url, status, requested_datetime, updated_datetime, service_code and service_name.') %]</p>
@@ -124,9 +124,6 @@ for council problem-reporting systems.</p>
] %]
[% FOREACH examples %]
<li><a href="[% url %]">[% info %]</a>
- [% IF url.match('/requests.xml') %]
- [ <a href="http://maps.google.com/?q=[% url.replace('.xml', '.rss') | uri %]">[% loc('GeoRSS on Google Maps') %]</a> ]
- [% END %]
<br>[% url | html %]</li>
[% END %]
diff --git a/templates/web/base/report/new/fill_in_details.html b/templates/web/base/report/new/fill_in_details.html
index debc2af2d..8fa1253da 100644
--- a/templates/web/base/report/new/fill_in_details.html
+++ b/templates/web/base/report/new/fill_in_details.html
@@ -2,7 +2,7 @@
sidebar_html = PROCESS 'report/new/sidebar.html';
SET bodyclass = '';
- SET bodyclass = 'mappage' IF report.used_map;
+ SET bodyclass = 'mappage';
SET bodyclass = bodyclass _ " with-notes" IF sidebar_html;
PROCESS "maps/${map.type}.html" IF report.used_map;
INCLUDE 'header.html', title => loc('Reporting a problem');
diff --git a/templates/web/fixamingata/open311/index.html b/templates/web/fixamingata/open311/index.html
index 995069ed2..6e86a933b 100644
--- a/templates/web/fixamingata/open311/index.html
+++ b/templates/web/fixamingata/open311/index.html
@@ -14,7 +14,7 @@
<li><a rel="nofollow" href="http://wiki.open311.org/GeoReport_v2">[% loc('Open311 specification') %]</a></li>
</ul>
-<p>[% tprintf( loc('At most %d requests are returned in each query. The returned requests are ordered by requested_datetime, so to get all requests, do several searches with rolling start_date and end_date.'), c.config.RSS_LIMIT ) %]</p>
+<p>[% tprintf( loc('At most %d requests are returned in each query. The returned requests are ordered by requested_datetime, so to get all requests, do several searches with rolling start_date and end_date.'), c.config.OPEN311_LIMIT ) %]</p>
<p>[% loc('The following Open311 v2 attributes are returned for each request: service_request_id, description, lat, long, media_url, status, requested_datetime, updated_datetime, service_code and service_name.') %]</p>
@@ -65,9 +65,6 @@
] %]
[% FOREACH examples %]
<li><a href="[% url %]">[% info %]</a>
- [% IF url.match('/requests.xml') %]
- [ <a href="http://maps.google.com/?q=[% url.replace('.xml', '.rss') | uri %]">[% loc('GeoRSS on Google Maps') %]</a> ]
- [% END %]
<br>[% url | html %]</li>
[% END %]