Add TurboStreamable concern to Settings::MutesController
This commit is contained in:
parent
f2024a990e
commit
c880fade4e
|
@ -3,6 +3,10 @@
|
|||
class Settings::MutesController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def turbo_stream_actions = %i[create destroy]
|
||||
|
||||
include TurboStreamable
|
||||
|
||||
def index
|
||||
@users = current_user.muted_users
|
||||
@rules = MuteRule.where(user: current_user)
|
||||
|
@ -15,7 +19,8 @@ class Settings::MutesController < ApplicationController
|
|||
format.turbo_stream do
|
||||
render turbo_stream: [
|
||||
turbo_stream.replace("form", partial: "settings/mutes/form"),
|
||||
turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: result[:resource] })
|
||||
turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: result[:resource] }),
|
||||
render_toast(t(".success"))
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -32,7 +37,10 @@ class Settings::MutesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
render turbo_stream: turbo_stream.remove("rule_#{params[:id]}")
|
||||
render turbo_stream: [
|
||||
turbo_stream.remove("rule_#{params[:id]}"),
|
||||
render_toast(t(".success"))
|
||||
]
|
||||
end
|
||||
|
||||
format.html { redirect_to settings_muted_path }
|
||||
|
|
|
@ -160,6 +160,11 @@ en:
|
|||
create:
|
||||
success: "Your account is currently being exported. This will take a little while."
|
||||
error: "Exporting is currently not possible."
|
||||
mutes:
|
||||
create:
|
||||
success: "Sucessfully created mute rule"
|
||||
destroy:
|
||||
success: "Successfully removed mute rule"
|
||||
privacy:
|
||||
update:
|
||||
success: :settings.profile.update.success
|
||||
|
|
Loading…
Reference in New Issue