mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:09:52 +01:00
Fix anonymous blocks causing exceptions without inboxes
This commit is contained in:
parent
4c0948c6d1
commit
5cb96a7907
1 changed files with 2 additions and 1 deletions
|
@ -16,12 +16,13 @@ class AnonymousBlockController < ApplicationController
|
|||
target_user: question.user
|
||||
)
|
||||
|
||||
inbox_id = question.inboxes.first.id
|
||||
inbox_id = question.inboxes.first&.id
|
||||
question.inboxes.first&.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
render turbo_stream: turbo_stream.remove("inbox_#{inbox_id}")
|
||||
inbox_id ? turbo_stream.remove("inbox_#{inbox_id}") : nil,
|
||||
end
|
||||
|
||||
format.html { redirect_back(fallback_location: inbox_path) }
|
||||
|
|
Loading…
Reference in a new issue