Fix anonymous blocks causing exceptions without inboxes
This commit is contained in:
parent
4c0948c6d1
commit
5cb96a7907
|
@ -16,12 +16,13 @@ class AnonymousBlockController < ApplicationController
|
||||||
target_user: question.user
|
target_user: question.user
|
||||||
)
|
)
|
||||||
|
|
||||||
inbox_id = question.inboxes.first.id
|
inbox_id = question.inboxes.first&.id
|
||||||
question.inboxes.first&.destroy
|
question.inboxes.first&.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
render turbo_stream: turbo_stream.remove("inbox_#{inbox_id}")
|
render turbo_stream: turbo_stream.remove("inbox_#{inbox_id}")
|
||||||
|
inbox_id ? turbo_stream.remove("inbox_#{inbox_id}") : nil,
|
||||||
end
|
end
|
||||||
|
|
||||||
format.html { redirect_back(fallback_location: inbox_path) }
|
format.html { redirect_back(fallback_location: inbox_path) }
|
||||||
|
|
Loading…
Reference in New Issue