diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 5 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 38a7a3909..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' ), } ); diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 7f6f4dc1a..3c07ac054 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -67,6 +67,7 @@ my $comment = FixMyStreet::App->model('DB::Comment')->find_or_create( text => 'This is some update text', state => 'confirmed', confirmed => $dt->ymd . ' ' . $dt->hms, + anonymous => 'f', } ); @@ -152,6 +153,7 @@ subtest "several updates shown in correct order" => sub { text => 'First update', state => 'confirmed', confirmed => '2011-03-10 12:23:15', + anonymous => 'f', }, { problem_id => $report_id, @@ -161,6 +163,7 @@ subtest "several updates shown in correct order" => sub { text => 'Second update', state => 'confirmed', confirmed => '2011-03-10 12:23:16', + anonymous => 'f', }, { problem_id => $report_id, |