Appease the dog overlords

This commit is contained in:
Karina Kwiatek 2022-06-15 00:17:02 +02:00 committed by Karina Kwiatek
parent 1e86043750
commit e660b731d7
7 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Ajax::AnonymousBlockController < AjaxController
def create
params.require :question
@ -7,7 +9,7 @@ class Ajax::AnonymousBlockController < AjaxController
AnonymousBlock.create!(
user: current_user,
identifier: AnonymousBlock.get_identifier(question.author_identifier),
question: question,
question: question
)
question.inboxes.first.destroy

View File

@ -40,7 +40,7 @@ class Ajax::QuestionController < AjaxController
author_is_anonymous: author_is_anonymous,
author_identifier: AnonymousBlock.get_identifier(request.ip),
user: current_user,
direct: params[:rcpt] != 'followers')
direct: params[:rcpt] != "followers")
rescue ActiveRecord::RecordInvalid => e
Sentry.capture_exception(e)
@response[:status] = :rec_inv

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AnonymousBlock < ApplicationRecord
belongs_to :user
belongs_to :question, optional: true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RenameAuthorEmailToAuthorIdentifier < ActiveRecord::Migration[6.1]
def change
rename_column :questions, :author_email, :author_identifier

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateAnonymousBlocks < ActiveRecord::Migration[6.1]
def change
create_table :anonymous_blocks do |t|

View File

@ -1,4 +1,5 @@
# frozen_string_literal: true
require "rails_helper"
describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do

View File

@ -266,7 +266,7 @@ describe Ajax::QuestionController, :ajax_controller, type: :controller do
AnonymousBlock.create(
user: target_user,
identifier: identifier,
question: dummy_question,
question: dummy_question
)
end