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