Use Mute Rule use cases in mutes controller

This commit is contained in:
Karina Kwiatek 2023-01-02 12:26:44 +01:00 committed by Andreas Nedbal
parent 8178d75a57
commit 04bc1da8cf
1 changed files with 3 additions and 3 deletions

View File

@ -9,13 +9,13 @@ class Settings::MutesController < ApplicationController
end
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|
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: })
turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: result[:resource] })
]
end
@ -28,7 +28,7 @@ class Settings::MutesController < ApplicationController
authorize rule
rule.destroy!
UseCase::MuteRule::Destroy.call(rule:)
respond_to do |format|
format.turbo_stream do