aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm7
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm4
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm1
5 files changed, 15 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 46ac10d36..8ec9eeaab 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -385,6 +385,9 @@ sub update_contacts : Private {
else {
$contact->unset_extra_metadata( 'inspection_required' );
}
+ if ( $c->get_param('reputation_threshold') ) {
+ $contact->set_extra_metadata( reputation_threshold => int($c->get_param('reputation_threshold')) );
+ }
if ( %errors ) {
$c->stash->{updated} = _('Please correct the errors below');
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 355a3f2a9..db3b16dcd 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -270,6 +270,8 @@ sub delete :Local :Args(1) {
$p->lastupdate( \'current_timestamp' );
$p->update;
+ $p->user->update_reputation(-1);
+
$c->model('DB::AdminLog')->create( {
admin_user => $c->user->email,
object_type => 'problem',
@@ -316,6 +318,7 @@ sub inspect : Private {
my $valid = 1;
my $update_text;
+ my $reputation_change = 0;
if ($permissions->{report_inspect}) {
foreach (qw/detailed_information traffic_information/) {
@@ -326,6 +329,7 @@ sub inspect : Private {
$update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } );
if ($update_text) {
$problem->set_extra_metadata( inspected => 1 );
+ $reputation_change = 1;
} else {
$valid = 0;
$c->stash->{errors} ||= [];
@@ -371,6 +375,9 @@ sub inspect : Private {
}
if ($valid) {
+ if ( $reputation_change != 0 ) {
+ $problem->user->update_reputation($reputation_change);
+ }
$problem->update;
if ( defined($update_text) ) {
$problem->add_to_comments( {
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 7766e08a1..75f54facf 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -86,7 +86,7 @@ sub report_new : Path : Args(0) {
# work out the location for this report and do some checks
# Also show map if we're just updating the filters
return $c->forward('redirect_to_around')
- if $c->get_param('filter_update') || !$c->forward('determine_location');
+ if !$c->forward('determine_location') || $c->get_param('filter_update');
# create a problem from the submitted details
$c->stash->{template} = "report/new/fill_in_details.html";
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index ddc75163a..49f477fec 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -55,7 +55,9 @@ sub index : Path : Args(0) {
}
# Fetch all bodies
- my @bodies = $c->model('DB::Body')->search({}, {
+ my @bodies = $c->model('DB::Body')->search({
+ deleted => 0,
+ }, {
'+select' => [ { count => 'area_id' } ],
'+as' => [ 'area_count' ],
join => 'body_areas',
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index 183b233a8..28f1aba43 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -207,6 +207,7 @@ sub generate : Private {
$out =~ s{(<link>.*?</link>)}{$1<uri>$uri</uri>};
$c->response->header('Content-Type' => 'application/xml; charset=utf-8');
+ $c->response->header('Access-Control-Allow-Origin' => '*');
$c->response->body( $out );
}