aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--perllib/FixMyStreet/App/Controller/Alert.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm11
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm8
-rw-r--r--t/app/controller/contact.t54
-rwxr-xr-xtemplates/web/default/around/display_location.html2
-rw-r--r--templates/web/default/contact/index.html4
-rw-r--r--templates/web/default/report/display.html4
9 files changed, 66 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index f41cdf212..073bd7ab7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ inc/
.sass-cache
_Inline/
lib
+tags \ No newline at end of file
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm
index aa51f1ba3..7ea0d77e3 100644
--- a/perllib/FixMyStreet/App/Controller/Alert.pm
+++ b/perllib/FixMyStreet/App/Controller/Alert.pm
@@ -132,10 +132,6 @@ sub subscribe_email : Private {
if ( $type eq 'updates' ) {
$c->forward('set_update_alert_options');
}
- elsif ( $type eq 'problems' ) {
-
-# $alert_id = FixMyStreet::Alert::create($email, 'new_problems', $cobrand, $cobrand_data);
- }
elsif ( $type eq 'local' ) {
$c->forward('set_local_alert_options');
}
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 0e6e60944..558a354c6 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -76,14 +76,11 @@ sub determine_contact_type : Private {
);
if ($update_id) {
+ my $update = $c->model('DB::Comment')->find(
+ { id => $update_id }
+ );
- # FIXME: updates not implemented yet
-
-# my $u = dbh()->selectrow_hashref(
-# 'select comment.text, comment.name, problem.title, extract(epoch from comment.confirmed) as confirmed
-# from comment, problem where comment.id=?
-# and comment.problem_id = problem.id
-# and comment.problem_id=?', {}, $update_id ,$id);
+ $c->stash->{update} = $update;
}
elsif ($problem) {
$c->stash->{problem} = $problem;
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index b6f336ffa..a36a13399 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -109,8 +109,6 @@ sub format_problem_for_display : Private {
$c->stash->{banner} = $c->cobrand->generate_problem_banner($problem);
- $c->stash->{allow_photo_upload} = $c->cobrand->allow_photo_display; # FIXME?
-
$c->stash->{cobrand_alert_fields} = $c->cobrand->form_elements('/alerts');
$c->stash->{cobrand_update_fields} =
$c->cobrand->form_elements('/updateForm');
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index 66216aa6e..9b5feb37d 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -79,7 +79,13 @@ sub created_local {
}
sub confirmed_local {
- return shift->confirmed->set_time_zone($tz);
+ my $self = shift;
+
+ # if confirmed is null then it doesn't get inflated so don't
+ # try and set the timezone
+ return $self->confirmed->set_time_zone($tz) if $self->confirmed;
+
+ return 0;
}
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index fbf794b6b..73660306d 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -31,6 +31,21 @@ for my $test (
anonymous => 1,
meta => 'Reported anonymously at 13:24, Tuesday 3 May 2011',
},
+ {
+ name => 'A User',
+ email => 'problem_report_test@example.com',
+ title => 'A different problem',
+ detail => 'More detail on the different problem',
+ postcode => 'EH99 1SP',
+ confirmed => '2011-05-03 13:24:28.145168',
+ anonymous => 1,
+ meta => 'Reported anonymously at 13:24, Tuesday 3 May 2011',
+ update => {
+ name => 'Different User',
+ email => 'commenter@example.com',
+ text => 'This is an update',
+ },
+ },
)
{
subtest 'check reporting a problem displays correctly' => sub {
@@ -58,13 +73,44 @@ for my $test (
}
);
+ my $update;
+
+ if ( $test->{update} ) {
+ my $update_info = $test->{update};
+ my $update_user = FixMyStreet::App->model('DB::User')->find_or_create(
+ {
+ name => $update_info->{name},
+ email => $update_info->{email}
+ }
+ );
+
+ $update = FixMyStreet::App->model('DB::Comment')->create(
+ {
+ problem_id => $problem->id,
+ user => $update_user,
+ state => 'confirmed',
+ text => $update_info->{text},
+ confirmed => \'ms_current_timestamp()',
+ mark_fixed => 'f',
+ anonymous => 'f',
+ }
+ );
+ }
+
ok $problem, 'succesfully create a problem';
- $mech->get_ok( '/contact?id=' . $problem->id );
- $mech->content_contains('reporting the following problem');
- $mech->content_contains( $test->{title} );
- $mech->content_contains( $test->{meta} );
+ if ( $update ) {
+ $mech->get_ok( '/contact?id=' . $problem->id . '&update_id=' . $update->id );
+ $mech->content_contains('reporting the following update');
+ $mech->content_contains( $test->{update}->{text} );
+ } else {
+ $mech->get_ok( '/contact?id=' . $problem->id );
+ $mech->content_contains('reporting the following problem');
+ $mech->content_contains( $test->{title} );
+ $mech->content_contains( $test->{meta} );
+ }
+ $update->delete if $update;
$problem->delete;
};
}
diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html
index 48ff5fcb8..de970e98a 100755
--- a/templates/web/default/around/display_location.html
+++ b/templates/web/default/around/display_location.html
@@ -9,7 +9,7 @@
: c.uri_for( "/rss/l/$short_latitude,$short_longitude" );
email_url = c.uri_for(
- '/alert',
+ '/alert/list',
{
lat => short_latitude,
lon => short_longitude,
diff --git a/templates/web/default/contact/index.html b/templates/web/default/contact/index.html
index ff08d10e8..35c7f7e36 100644
--- a/templates/web/default/contact/index.html
+++ b/templates/web/default/contact/index.html
@@ -14,10 +14,8 @@
[% loc('You are reporting the following update for being abusive, containing personal information, or similar:') %]
</p>
- [% IF update.title %]
+ [% IF update.text %]
<blockquote>
- <h2>[% update.title | html %]</h2>
-
<p>
[% IF update.anonymous %]
[% tprintf( loc('Update below added anonymously at %s'), prettify_epoch( update.confirmed_local.epoch ) ) %]
diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html
index 05b594b7b..959f76d2b 100644
--- a/templates/web/default/report/display.html
+++ b/templates/web/default/report/display.html
@@ -72,7 +72,7 @@
[% INCLUDE 'errors.html' %]
- <form method="post" action="[% c.uri_for( '/report/update' ) %]" name="updateForm" id="fieldset"[% IF allow_photo_upload %] enctype="multipart/form-data"[% END %]>
+ <form method="post" action="[% c.uri_for( '/report/update' ) %]" name="updateForm" id="fieldset"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]>
<input type="hidden" name="submit_update" value="1">
<input type="hidden" name="id" value="[% problem.id | html %]">
@@ -113,7 +113,7 @@
[% END %]
- [% IF allow_photo_upload %]
+ [% IF c.cobrand.allow_photo_upload %]
[% IF photo_error %]
<div class='form-error'>[% photo_error %]</div>
[% END %]