aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin/Triage.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-07-10 14:38:17 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-07-14 18:25:19 +0100
commit67823bc788ce744e1228a8602b9a5aa805771ced (patch)
tree0b1eddd4e071314573e52206d0061cab022e1cd0 /perllib/FixMyStreet/App/Controller/Admin/Triage.pm
parenteed6158981240afce10824e82fa86f14b38f3167 (diff)
Centralise update creation to include fields.
Given the user, we can infer the name if not provided, and the extra data if a staff user. We can also provide defaults for various other fields. Always have superuser take precedence over from_body.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin/Triage.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/Triage.pm17
1 files changed, 2 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Triage.pm b/perllib/FixMyStreet/App/Controller/Admin/Triage.pm
index 7cfcc93dd..c5bb6628d 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/Triage.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/Triage.pm
@@ -117,27 +117,14 @@ sub update : Private {
$c->stash->{problem}->update( { state => 'confirmed' } );
$c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'triage' ] );
- my $name = $c->user->moderating_user_name;
- my $extra = { is_superuser => 1 };
- if ($c->user->from_body) {
- delete $extra->{is_superuser};
- $extra->{is_body_user} = $c->user->from_body->id;
- }
-
+ my $extra;
$extra->{triage_report} = 1;
$extra->{holding_category} = $current_category;
$extra->{new_category} = $new_category;
- my $timestamp = \'current_timestamp';
my $comment = $problem->add_to_comments( {
text => "Report triaged from $current_category to $new_category",
- created => $timestamp,
- confirmed => $timestamp,
- user_id => $c->user->id,
- name => $name,
- mark_fixed => 0,
- anonymous => 0,
- state => 'confirmed',
+ user => $c->user->obj,
problem_state => $problem->state,
extra => $extra,
whensent => \'current_timestamp',