Add TurboStreamable concern to AnonymousBlock controller
This commit is contained in:
parent
5cb96a7907
commit
f2024a990e
|
@ -3,6 +3,10 @@
|
|||
class AnonymousBlockController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def turbo_stream_actions = %i[create destroy]
|
||||
|
||||
include TurboStreamable
|
||||
|
||||
def create
|
||||
params.require :question
|
||||
|
||||
|
@ -21,8 +25,10 @@ class AnonymousBlockController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
render turbo_stream: turbo_stream.remove("inbox_#{inbox_id}")
|
||||
render turbo_stream: [
|
||||
inbox_id ? turbo_stream.remove("inbox_#{inbox_id}") : nil,
|
||||
render_toast(t(".success"))
|
||||
].compact
|
||||
end
|
||||
|
||||
format.html { redirect_back(fallback_location: inbox_path) }
|
||||
|
@ -39,7 +45,10 @@ class AnonymousBlockController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
render turbo_stream: turbo_stream.remove("block_#{params[:id]}")
|
||||
render turbo_stream: [
|
||||
turbo_stream.remove("block_#{params[:id]}"),
|
||||
render_toast(t(".success"))
|
||||
]
|
||||
end
|
||||
|
||||
format.html { redirect_back(fallback_location: settings_blocks_path) }
|
||||
|
|
|
@ -144,6 +144,11 @@ en:
|
|||
zero: "You are not currently subscribed to push notifications on any devices."
|
||||
one: "You are currently receiving push notifications on one device."
|
||||
other: "You are currently receiving push notifications on %{count} devices."
|
||||
anonymous_block:
|
||||
create:
|
||||
success: "Successfully blocked user."
|
||||
destroy:
|
||||
success: "Successfully unblocked user."
|
||||
inbox:
|
||||
author:
|
||||
info: "No questions from @%{author} found, showing entries from all users instead!"
|
||||
|
|
Loading…
Reference in New Issue