aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm20
-rw-r--r--t/app/controller/report_updates.t1
-rw-r--r--templates/web/tfl/front/pre-steps.html12
3 files changed, 21 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index c876f3459..2ef8925e6 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -145,6 +145,26 @@ sub FOREIGNBUILDARGS {
return $opts;
};
+=head2 around user
+
+Also make sure we catch the setting of a user on an object at a time other than
+object creation, to set the extra field needed.
+
+=cut
+
+around user => sub {
+ my ( $orig, $self ) = ( shift, shift );
+ my $res = $self->$orig(@_);
+ if (@_) {
+ if ($_[0]->is_superuser) {
+ $self->set_extra_metadata( is_superuser => 1 );
+ } elsif (my $body = $_[0]->from_body) {
+ $self->set_extra_metadata( is_body_user => $body->id );
+ }
+ }
+ return $res;
+};
+
=head2 get_cobrand_logged
Get a cobrand object for the cobrand the update was made on.
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 3198cf70c..0b60ac02b 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -907,6 +907,7 @@ subtest "check comment with no status change has not status in meta" => sub {
is $report->state, 'investigating', 'correct report state';
is $update->problem_state, 'investigating', 'correct update state';
+ is $update->get_extra_metadata('is_body_user'), $body->id, 'correct metadata';
$update_meta = $mech->extract_update_metas;
like $update_meta->[0], qr/fixed/i, 'first update meta says fixed';
unlike $update_meta->[2], qr/State changed to/, 'second update meta does not include state change';
diff --git a/templates/web/tfl/front/pre-steps.html b/templates/web/tfl/front/pre-steps.html
deleted file mode 100644
index 1dead5c89..000000000
--- a/templates/web/tfl/front/pre-steps.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<p style="max-width: 38em; font-size: 1.2em; margin-bottom: 2.5em;">
- <strong>
- All issues reported on Streetcare continue to be monitored by our teams at
- Transport for London. We are not able to carry out all of our normal
- maintenance works at the moment but we are working hard to deal with all
- safety critical issues.
- </strong>
- <br>
- If you are concerned about pavement overcrowding during social distancing
- on the Transport for London Road Network, you can now report that to us
- here.
-</p>