Appease the robot canine

This commit is contained in:
Karina Kwiatek 2022-08-13 21:21:17 +02:00
parent 136eac8bdd
commit 92a5095c00
3 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@ class Ajax::AnonymousBlockController < AjaxController
AnonymousBlock.create!( AnonymousBlock.create!(
user: params[:global] ? nil : current_user, user: params[:global] ? nil : current_user,
identifier: question.author_identifier, identifier: question.author_identifier,
question:, question:
) )
question.inboxes.first.destroy question.inboxes.first.destroy

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Moderation::AnonymousBlockController < ApplicationController class Moderation::AnonymousBlockController < ApplicationController
def index def index
@anonymous_blocks = AnonymousBlock.where(user: nil) @anonymous_blocks = AnonymousBlock.where(user: nil)

View File

@ -15,7 +15,7 @@ describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
context "when all required parameters are given" do context "when all required parameters are given" do
let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") } let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") }
let!(:inbox) { FactoryBot.create(:inbox, user: user, question: question) } let!(:inbox) { FactoryBot.create(:inbox, user:, question:) }
let(:params) do let(:params) do
{ question: question.id } { question: question.id }
end end
@ -37,7 +37,7 @@ describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
context "when blocking a user globally" do context "when blocking a user globally" do
let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") } let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") }
let!(:inbox) { FactoryBot.create(:inbox, user: user, question: question) } let!(:inbox) { FactoryBot.create(:inbox, user:, question:) }
let(:params) do let(:params) do
{ question: question.id, global: "true" } { question: question.id, global: "true" }
end end