diff --git a/app/controllers/settings/mutes_controller.rb b/app/controllers/settings/mutes_controller.rb index 6740a1ac..38675db3 100644 --- a/app/controllers/settings/mutes_controller.rb +++ b/app/controllers/settings/mutes_controller.rb @@ -18,4 +18,17 @@ class Settings::MutesController < ApplicationController format.html { redirect_to settings_muted_path } end end + + def destroy + rule = MuteRule.find(params[:id]) + rule.destroy! + + respond_to do |format| + format.turbo_stream do + render turbo_stream: turbo_stream.remove("rule_#{params[:id]}") + end + + format.html { redirect_to settings_muted_path } + end + end end diff --git a/config/routes.rb b/config/routes.rb index 865740b7..62c550e8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -82,6 +82,8 @@ Rails.application.routes.draw do post :export, to: "export#create" get :muted, to: "mutes#index" + post :muted, to: "mutes#create" + delete "muted/:id", to: "mutes#destroy", as: :muted_destroy get :blocks, to: "blocks#index" @@ -130,9 +132,6 @@ Rails.application.routes.draw do post "/list_membership", to: "list#membership", as: :list_membership post "/subscribe", to: "subscription#subscribe", as: :subscribe_answer post "/unsubscribe", to: "subscription#unsubscribe", as: :unsubscribe_answer - post "/mute", to: "mute_rule#create", as: :create_mute_rule - post "/mute/:id", to: "mute_rule#update", as: :update_mute_rule - delete "/mute/:id", to: "mute_rule#destroy", as: :delete_mute_rule post "/block_anon", to: "anonymous_block#create", as: :block_anon delete "/block_anon/:id", to: "anonymous_block#destroy", as: :unblock_anon end