From e660b731d7944a3762dadf5db9efb5ffd1a81600 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Wed, 15 Jun 2022 00:17:02 +0200 Subject: [PATCH] Appease the dog overlords --- app/controllers/ajax/anonymous_block_controller.rb | 4 +++- app/controllers/ajax/question_controller.rb | 2 +- app/models/anonymous_block.rb | 2 ++ ...20220613221551_rename_author_email_to_author_identifier.rb | 2 ++ db/migrate/20220614141439_create_anonymous_blocks.rb | 2 ++ spec/controllers/ajax/anonymous_block_controller_spec.rb | 1 + spec/controllers/ajax/question_controller_spec.rb | 2 +- 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/ajax/anonymous_block_controller.rb b/app/controllers/ajax/anonymous_block_controller.rb index b9262264..8458e47f 100644 --- a/app/controllers/ajax/anonymous_block_controller.rb +++ b/app/controllers/ajax/anonymous_block_controller.rb @@ -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 diff --git a/app/controllers/ajax/question_controller.rb b/app/controllers/ajax/question_controller.rb index 69636c22..66ed7d58 100644 --- a/app/controllers/ajax/question_controller.rb +++ b/app/controllers/ajax/question_controller.rb @@ -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 diff --git a/app/models/anonymous_block.rb b/app/models/anonymous_block.rb index a6f51e5d..087b7b8c 100644 --- a/app/models/anonymous_block.rb +++ b/app/models/anonymous_block.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnonymousBlock < ApplicationRecord belongs_to :user belongs_to :question, optional: true diff --git a/db/migrate/20220613221551_rename_author_email_to_author_identifier.rb b/db/migrate/20220613221551_rename_author_email_to_author_identifier.rb index 17759871..55c3199f 100644 --- a/db/migrate/20220613221551_rename_author_email_to_author_identifier.rb +++ b/db/migrate/20220613221551_rename_author_email_to_author_identifier.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RenameAuthorEmailToAuthorIdentifier < ActiveRecord::Migration[6.1] def change rename_column :questions, :author_email, :author_identifier diff --git a/db/migrate/20220614141439_create_anonymous_blocks.rb b/db/migrate/20220614141439_create_anonymous_blocks.rb index a9405039..c6609063 100644 --- a/db/migrate/20220614141439_create_anonymous_blocks.rb +++ b/db/migrate/20220614141439_create_anonymous_blocks.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateAnonymousBlocks < ActiveRecord::Migration[6.1] def change create_table :anonymous_blocks do |t| diff --git a/spec/controllers/ajax/anonymous_block_controller_spec.rb b/spec/controllers/ajax/anonymous_block_controller_spec.rb index 97537bae..24730037 100644 --- a/spec/controllers/ajax/anonymous_block_controller_spec.rb +++ b/spec/controllers/ajax/anonymous_block_controller_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "rails_helper" describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do diff --git a/spec/controllers/ajax/question_controller_spec.rb b/spec/controllers/ajax/question_controller_spec.rb index af936378..d4eb9f43 100644 --- a/spec/controllers/ajax/question_controller_spec.rb +++ b/spec/controllers/ajax/question_controller_spec.rb @@ -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