mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-13 21:33:20 +01:00
Use Mute Rule use cases in mutes controller
This commit is contained in:
parent
8178d75a57
commit
04bc1da8cf
1 changed files with 3 additions and 3 deletions
|
@ -9,13 +9,13 @@ class Settings::MutesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
rule = MuteRule.create!(user: current_user, muted_phrase: params[:muted_phrase])
|
result = UseCase::MuteRule::Create.call(user: current_user, phrase: params[:muted_phrase])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
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: })
|
turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: result[:resource] })
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class Settings::MutesController < ApplicationController
|
||||||
|
|
||||||
authorize rule
|
authorize rule
|
||||||
|
|
||||||
rule.destroy!
|
UseCase::MuteRule::Destroy.call(rule:)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
|
|
Loading…
Reference in a new issue