diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Contact.pm | 15 | ||||
-rw-r--r-- | t/app/controller/contact.t | 2 | ||||
-rw-r--r-- | templates/web/default/contact/index.html | 4 |
3 files changed, 18 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index 2980b3811..9a19f471e 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -80,7 +80,20 @@ sub determine_contact_type : Private { $update_id = undef unless $update_id && $update_id =~ /^[1-9]\d*$/; if ($id) { - my $problem = $c->model('DB::Problem')->find( { id => $id } ); + my $problem = $c->model('DB::Problem')->find( + { id => $id }, + { + 'select' => [ + 'title', 'detail', 'name', + 'anonymous', + 'user_id', + { + extract => 'epoch from confirmed', + -as => 'confirmed' + } + ] + } + ); if ( $update_id ) { # my $u = dbh()->selectrow_hashref( diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 60e330776..d4c31bd20 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -24,6 +24,7 @@ subtest 'check reporting a problem displays correctly' => sub { title => 'Some problem or other', detail => 'More detail on the problem', postcode => 'EH99 1SP', + confirmed => '2011-05-04 10:44:28.145168', latitude => 0, longitude => 0, areas => 0, @@ -41,6 +42,7 @@ subtest 'check reporting a problem displays correctly' => sub { $mech->content_contains( 'reporting the following problem' ); $mech->content_contains( 'Some problem or other' ); $mech->content_contains( 'Reported by A User' ); + $mech->content_contains( 'Reported by A User at 10:44, Wednesday 4 May 2011' ); $problem->delete; }; diff --git a/templates/web/default/contact/index.html b/templates/web/default/contact/index.html index 5ab5bad8c..dc5c43fdf 100644 --- a/templates/web/default/contact/index.html +++ b/templates/web/default/contact/index.html @@ -22,7 +22,7 @@ [% IF update.anonymous %] [% tprintf( loc('Update below added anonymously at %s'), update.confirmed ) %] [% ELSE %] - [% tprintf( loc('Update below added by %s at %s'), update.name, problem.confirmed ) | html %] + [% tprintf( loc('Update below added by %s at %s'), update.name, prettify_epoch( update.confirmed ) ) | html %] [% END %] </p> @@ -46,7 +46,7 @@ [% IF problem.anonymous %] [% tprintf( loc('Reported anonymously at %s'), problem.confirmed ) %] [% ELSE %] - [% tprintf( loc('Reported by %s at %s'), problem.user.name, problem.confirmed ) | html %] + [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_epoch( problem.confirmed ) ) | html %] [% END %] </p> |