aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm43
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm9
2 files changed, 18 insertions, 34 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index ff471d7cd..0b235a06e 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -43,10 +43,6 @@ Display a report.
sub display : Path('') : Args(1) {
my ( $self, $c, $id ) = @_;
-# my ($q, $errors, $field_errors) = @_;
-# my @errors = @$errors;
-# my %field_errors = %{$field_errors};
-# my $cobrand = Page::get_cobrand($q);
# push @errors, _('There were problems with your update. Please see below.') if (scalar keys %field_errors);
# my @vars = qw(id name rznvy update fixed add_alert upload_fileid submit_update);
@@ -63,39 +59,14 @@ sub display : Path('') : Args(1) {
}
$c->forward('load_problem_or_display_error', [ $id ] );
-
- # my $extra_data = Cobrand::extra_data($cobrand, $q);
- # my $google_link = Cobrand::base_url_for_emails($cobrand, $extra_data)
- # . '/report/' . $problem->{id};
- # # truncate the lat,lon for nicer rss urls
- # my ( $short_lat, $short_lon ) =
- # map { Utils::truncate_coordinate($_) } #
- # ( $problem->{latitude}, $problem->{longitude} );
-
-
-
-# my $fixed = ($input{fixed}) ? ' checked' : '';
-
$c->forward( 'format_problem_for_display' );
-# my %vars = (
-# url_home => Cobrand::url($cobrand, '/', $q),
-# field_errors => \%field_errors,
-# add_alert_checked => ($input{add_alert} || !$input{submit_update}) ? ' checked' : '',
-# form_action => Cobrand::url($cobrand, '/', $q),
-# );
#
# $vars{update_blurb} = $q->p($q->small(_('Please note that updates are not sent to the council. If you leave your name it will be public. Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>')))
# unless $q->{site} eq 'emptyhomes'; # No council blurb
#
# my %params = (
-# rss => [ _('Updates to this problem, FixMyStreet'), "/rss/$input_h{id}" ],
-# robots => 'index, nofollow',
# js => FixMyStreet::Map::header_js(),
-# title => $problem->{title}
# );
-#
-# my $page = Page::template_include('problem', $q, Page::template_root($q), %vars);
-# return ($page, %params);
}
@@ -196,14 +167,20 @@ sub format_problem_for_display : Private {
( $problem->latitude, $problem->longitude );
$c->stash->{report_name} = $c->req->param('name');
- $c->stash->{update} = $c->req->param('update');
- $c->stash->{email} = $c->req->param('rznvy');
+
+ if ( $c->req->param('submit_update' ) ) {
+ $c->stash->{update} = $c->req->param('update');
+ $c->stash->{email} = $c->req->param('rznvy');
+ $c->stash->{fixed} = $c->req->param('fixed') ? ' checked' : '';
+ $c->stash->{add_alert} = $c->req->param('add_alert') ? ' checked' : '';
+ } else {
+ $c->stash->{add_alert} = ' checked';
+ }
+
$c->forward('generate_map_tags');
$c->forward('generate_problem_meta');
- # problem_updates => Page::display_problem_updates($input{id}, $q),
-
return 1;
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 999bd08ff..1100cf17b 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -100,10 +100,12 @@ sub process_update : Private {
$params{update} =
Utils::cleanup_text( $params{update}, { allow_multiline => 1 } );
+ my $name = Utils::trim_text( $params{ name } );
+
my $update = $c->model('DB::Comment')->new(
{
text => $params{update},
- name => Utils::trim_text( $params{name} ),
+ name => $name,
problem => $c->stash->{problem},
user => $c->stash->{update_user},
state => 'unconfirmed',
@@ -111,6 +113,7 @@ sub process_update : Private {
cobrand => $c->cobrand->moniker,
cobrand_data => $c->cobrand->extra_update_data,
lang => $c->stash->{lang_code},
+ anonymous => ( $name ? 'f': 't' ),
}
);
@@ -147,6 +150,10 @@ sub check_for_errors : Private {
$c->stash->{field_errors} = \%field_errors;
+ $c->stash->{errors} ||= [];
+ push @{ $c->stash->{errors} },
+ _('There were problems with your update. Please see below.');
+
return;
}