Remove Mute Rule update endpoint

This endpoint was never used
This commit is contained in:
Karina Kwiatek 2022-07-24 10:58:39 +02:00
parent a8c936da8b
commit 7f9764a681
3 changed files with 0 additions and 54 deletions

View file

@ -15,32 +15,6 @@ class Ajax::MuteRuleController < AjaxController
@response[:id] = rule.id
end
def update
params.require :id
params.require :muted_phrase
unless user_signed_in?
@response[:status] = :noauth
@response[:message] = t(".noauth")
return
end
rule = MuteRule.find(params[:id])
if rule.user_id != current_user.id
@response[:status] = :nopriv
@response[:message] = t(".nopriv")
return
end
rule.muted_phrase = params[:muted_phrase]
rule.save!
@response[:status] = :okay
@response[:message] = t(".success")
@response[:success] = true
end
def destroy
params.require :id

View file

@ -129,7 +129,6 @@ Rails.application.routes.draw do
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

View file

@ -31,33 +31,6 @@ describe Ajax::MuteRuleController, :ajax_controller, type: :controller do
end
end
describe "#update" do
subject { post(:update, params: params) }
context "when user is signed in" do
before(:each) { sign_in(user) }
let(:rule) { MuteRule.create(user: user, muted_phrase: 'test') }
let(:params) { { id: rule.id, muted_phrase: 'dogs' } }
let(:expected_response) do
{
"success" => true,
"status" => "okay",
"message" => "Rule updated successfully."
}
end
it "updates a mute rule" do
subject
expect(response).to have_http_status(:success)
expect(rule.reload.muted_phrase).to eq('dogs')
end
include_examples "returns the expected response"
end
end
describe "#destroy" do
subject { delete(:destroy, params: params) }