aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet.pm3
-rw-r--r--perllib/FixMyStreet/App.pm8
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
4 files changed, 16 insertions, 3 deletions
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm
index 6c664f1d1..cc5286bbb 100644
--- a/perllib/FixMyStreet.pm
+++ b/perllib/FixMyStreet.pm
@@ -92,12 +92,13 @@ sub override_config($&) {
mySociety::MaPit::configure($config->{MAPIT_URL}) if $config->{MAPIT_URL};
- # For historical reasons, we have two ways of askig for config variables.
+ # For historical reasons, we have two ways of asking for config variables.
# Override them both, I'm sure we'll find time to get rid of one eventually.
my $override_guard1 = Sub::Override->new(
"FixMyStreet::config",
sub {
my ($class, $key) = @_;
+ return { %CONFIG, %$config } unless $key;
return $config->{$key} if exists $config->{$key};
my $orig_config = mySociety::Config::load_default();
return $orig_config->{$key} if exists $orig_config->{$key};
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index cf766348f..4f70d2c68 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -208,6 +208,14 @@ sub setup_request {
DateTime->DefaultLocale( 'en_US' );
}
+ if (FixMyStreet->test_mode) {
+ # Is there a better way of altering $c->config that may have
+ # override_config involved?
+ $c->setup_finished(0);
+ $c->config( %{ FixMyStreet->config() } );
+ $c->setup_finished(1);
+ }
+
return $c;
}
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 822860487..07bd61cbb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -765,7 +765,7 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->photo(undef);
}
- if ( $new_state eq 'confirmed' and $old_state eq 'unconfirmed' ) {
+ if ( $problem->is_visible() and $old_state eq 'unconfirmed' ) {
$problem->confirmed( \'ms_current_timestamp()' );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 6018dfa80..59d38a6cf 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -956,7 +956,11 @@ sub check_for_errors : Private {
delete $field_errors{name};
my $report = $c->stash->{report};
$report->title( Utils::cleanup_text( substr($report->detail, 0, 25) ) );
- if ( ! $c->req->param('phone') ) {
+
+ # We only want to validate the phone number web requests (where the
+ # service parameter is blank) because previous versions of the mobile
+ # apps don't validate the presence of a phone number.
+ if ( ! $c->req->param('phone') and ! $c->req->param('service') ) {
$field_errors{phone} = _("This information is required");
}
}