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.pm9
-rwxr-xr-xperllib/FixMyStreet/App/Controller/JS.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm31
4 files changed, 37 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 4999d16f2..7a2790b31 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -33,6 +33,11 @@ sub begin : Private {
my ( $self, $c ) = @_;
$c->uri_disposition('relative');
+
+ if ( $c->cobrand->moniker eq 'seesomething' ) {
+ $c->detach( '/auth/redirect' ) unless $c->user_exists;
+ $c->detach( '/auth/redirect' ) unless $c->user->from_council;
+ }
}
sub summary : Path( 'summary' ) : Args(0) {
@@ -927,6 +932,10 @@ sub stats : Path('stats') : Args(0) {
$c->forward('set_up_council_details');
+ if ( $c->cobrand->moniker eq 'seesomething' ) {
+ return $c->cobrand->admin_stats();
+ }
+
if ( $c->req->param('getcounts') ) {
my ( $start_date, $end_date, @errors );
diff --git a/perllib/FixMyStreet/App/Controller/JS.pm b/perllib/FixMyStreet/App/Controller/JS.pm
index ae2f06605..d7847af75 100755
--- a/perllib/FixMyStreet/App/Controller/JS.pm
+++ b/perllib/FixMyStreet/App/Controller/JS.pm
@@ -24,6 +24,8 @@ sub validation_strings : LocalRegex('^validation_strings\.(.*?)\.js$') : Args(0)
$c->res->content_type( 'application/javascript' );
}
+sub validation_rules : Path('validation_rules.js') : Args(0) { }
+
__PACKAGE__->meta->make_immutable;
1;
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index a7e1e8a3a..ef966a8a8 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -95,7 +95,7 @@ sub load_problem_or_display_error : Private {
if ( !$c->user || $c->user->id != $problem->user->id ) {
$c->detach(
'/page_error_403_access_denied',
- [ _('That report cannot be viewed on FixMyStreet.') ] #
+ [ sprintf(_('That report cannot be viewed on %s.'), $c->cobrand->site_title) ] #
);
}
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 31c184733..9194f5318 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -194,6 +194,7 @@ sub report_form_ajax : Path('ajax') : Args(0) {
councils_text => $councils_text,
category => $category,
extra_name_info => $extra_name_info,
+ categories => $c->stash->{category_options},
}
);
@@ -712,6 +713,14 @@ sub process_user : Private {
my $user_title = Utils::trim_text( $params{fms_extra_title} );
+ if ( $c->cobrand->allow_anonymous_reports ) {
+ my $anon_details = $c->cobrand->anonymous_account;
+
+ for my $key ( qw( email name ) ) {
+ $params{ $key } ||= $anon_details->{ $key };
+ }
+ }
+
# The user is already signed in
if ( $c->user_exists ) {
my $user = $c->user->obj;
@@ -776,6 +785,7 @@ sub process_report : Private {
'detail_offensive',
'may_show_name', #
'category', #
+ 'subcategory', #
'partial', #
'service', #
);
@@ -808,6 +818,8 @@ sub process_report : Private {
# set these straight from the params
$report->category( _ $params{category} ) if $params{category};
+ $report->subcategory( $params{subcategory} );
+
my $areas = $c->stash->{all_areas};
$report->areas( ',' . join( ',', sort keys %$areas ) . ',' );
@@ -925,11 +937,7 @@ sub check_for_errors : Private {
# let the model check for errors
$c->stash->{field_errors} ||= {};
- my %field_errors = (
- %{ $c->stash->{field_errors} },
- %{ $c->stash->{report}->user->check_for_errors },
- %{ $c->stash->{report}->check_for_errors },
- );
+ my %field_errors = $c->cobrand->report_check_for_errors( $c );
# Zurich, we don't care about title or name
# There is no title, and name is optional
@@ -974,7 +982,14 @@ sub save_user_and_report : Private {
my $report = $c->stash->{report};
# Save or update the user if appropriate
- if ( !$report->user->in_storage ) {
+ if ( $c->cobrand->never_confirm_reports ) {
+ if ( $report->user->in_storage() ) {
+ $report->user->update();
+ } else {
+ $report->user->insert();
+ }
+ $report->confirm();
+ } elsif ( !$report->user->in_storage ) {
# User does not exist.
# Store changes in token for when token is validated.
$c->stash->{token_data} = {
@@ -1100,6 +1115,10 @@ sub redirect_or_confirm_creation : Private {
if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) {
$report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } );
+ } elsif ( $c->cobrand->never_confirm_reports && $report->non_public ) {
+ $c->log->info( 'cobrand was set to always confirm reports and report was non public, success page showed');
+ $c->stash->{template} = 'report_created.html';
+ return 1;
} else {
$report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url;
}