aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-02-26 11:25:37 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-26 13:52:14 +0000
commita6b58401b3bef860713f96c1ba5c576bd94e0b10 (patch)
tree51993962226e1de3754f0f1da13c4429f46b8ef5 /perllib
parent75cf754c0b13b4547d249423c20f3fe9903deb12 (diff)
Fix error hiding user's updates with no confirmed.
If a user had no confirmed updates, but did have e.g. an unconfirmed update that had mark_fixed set, you would get an error when trying to hide the user's reports/updates.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm1
1 files changed, 1 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index bac183271..b217bf96c 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -292,6 +292,7 @@ sub is_latest {
{ problem_id => $self->problem_id, state => 'confirmed' },
{ order_by => [ { -desc => 'confirmed' }, { -desc => 'id' } ] }
)->first;
+ return unless $latest_update;
return $latest_update->id == $self->id;
}