From e7a4140ead92712f485f4d8ed4277f71e980f1cb Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Fri, 26 Apr 2024 18:07:15 +0200 Subject: [PATCH] Do not call `link_to_reportable` if reportable does not exist We call the `link_to_reportables` helper on the report show view. This throws an `nil` exception when the reportable is deleted, since the `reportable_type` gets nullified as well. `link_to_reportable` works in on the email notification since the `reportable_type` is still available from the event payload, but we cannot retrieve it from the report record. Fixes #16062 --- src/api/app/views/webui/reports/show.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/app/views/webui/reports/show.html.haml b/src/api/app/views/webui/reports/show.html.haml index a341ddd501b..080d65a7159 100644 --- a/src/api/app/views/webui/reports/show.html.haml +++ b/src/api/app/views/webui/reports/show.html.haml @@ -8,8 +8,9 @@ %p Created by = render UserAvatarComponent.new(@report.user.login) - on - = link_to_reportables(report_id: @report.id, reportable_type: @report.reportable_type, host: '') + - if @report.reportable.present? + on + = link_to_reportables(report_id: @report.id, reportable_type: @report.reportable_type, host: '') %h5 Description %p = @report.reason