diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 2 | ||||
-rw-r--r-- | perllib/Page.pm | 55 | ||||
-rw-r--r-- | templates/web/default/report/updates.html | 11 |
3 files changed, 9 insertions, 59 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 8de909738..e0a7033b9 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -326,8 +326,6 @@ sub signup_for_alerts : Private { ); $alert->confirm(); - - $alert->update; } return 1; diff --git a/perllib/Page.pm b/perllib/Page.pm index 27424d02e..39d5b6726 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -14,7 +14,6 @@ package Page; use strict; use Carp; use mySociety::CGIFast qw(-no_xhtml); -use Data::Dumper; use Encode; use Error qw(:try); use File::Slurp; @@ -656,60 +655,6 @@ sub display_problem_text($$) { return $out; } -# Display updates -sub display_problem_updates($$) { - my ($id, $q) = @_; - my $cobrand = get_cobrand($q); - my $updates = select_all( - "select id, name, extract(epoch from confirmed) as confirmed, text, - mark_fixed, mark_open, photo, cobrand - from comment where problem_id = ? and state='confirmed' - order by confirmed", $id); - my $out = ''; - if (@$updates) { - $out .= '<div id="updates">'; - $out .= '<h2 class="problem-update-list-header">' . _('Updates') . '</h2>'; - foreach my $row (@$updates) { - $out .= "<div><div class=\"problem-update\"><p><a name=\"update_$row->{id}\"></a><em>"; - if ($row->{name}) { - $out .= sprintf(_('Posted by %s at %s'), ent($row->{name}), prettify_epoch($q, $row->{confirmed})); - } else { - $out .= sprintf(_('Posted anonymously at %s'), prettify_epoch($q, $row->{confirmed})); - } - $out .= Cobrand::extra_update_meta_text($cobrand, $row); - $out .= ', ' . _('marked as fixed') if ($row->{mark_fixed}); - $out .= ', ' . _('reopened') if ($row->{mark_open}); - $out .= '</em></p>'; - - my $allow_update_reporting = Cobrand::allow_update_reporting($cobrand); - if ($allow_update_reporting) { - my $contact = '/contact?id=' . $id . ';update_id='. $row->{id}; - my $contact_url = Cobrand::url($cobrand, $contact, $q); - $out .= '<p>'; - $out .= $q->a({rel => 'nofollow', class => 'unsuitable-problem', href => $contact_url}, _('Offensive? Unsuitable? Tell us')); - $out .= '</p>'; - } - $out .= '</div>'; - $out .= '<div class="update-text">'; - my $text = $row->{text}; - $text =~ s/\r//g; - foreach (split /\n{2,}/, $text) { - $out .= '<p>' . ent($_) . '</p>'; - } - my $cobrand = get_cobrand($q); - my $display_photos = Cobrand::allow_photo_display($cobrand); - if ($display_photos && $row->{photo}) { - my $dims = Image::Size::html_imgsize(\$row->{photo}); - $out .= "<p><img alt='' $dims src='/photo?c=$row->{id}'></p>"; - } - $out .= '</div>'; - $out .= '</div>'; - } - $out .= '</div>'; - } - return $out; -} - sub mapit_check_error { my $location = shift; if ($location->{error}) { diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index b7f44c5ae..910430114 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -9,12 +9,19 @@ [%- ELSE %] [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%] [%- END -%] - [%- # extra cobrand meta data -%] + [%- c.cobrand.extra_update_meta_text(update) -%] [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %] [%- ", " _ loc( 'reopened' ) IF update.mark_open %] </em></p> + + [% IF c.cobrand.allow_update_reporting %] + <p> + <a rel="nofollow" class="unsuitable-problem" href="[% c.uri_for( '/contact?id=' _ update.problem_id _ ';update_id' _ update.id ) %]">[% loc('Offensive? Unsuitable? Tell us') %]</a> + </p> + [% END %] + </div> - [%# update reporting %] + <div class="update-text"> [% add_links( update.text ) | html_para %] |