Skip to content

Commit

Permalink
Do not call link_to_reportable if reportable does not exist
Browse files Browse the repository at this point in the history
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 openSUSE#16062
  • Loading branch information
krauselukas committed Apr 26, 2024
1 parent a0ef9a9 commit e7a4140
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/api/app/views/webui/reports/show.html.haml
Expand Up @@ -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
Expand Down

0 comments on commit e7a4140

Please sign in to comment.