Appease the dog overlords
This commit is contained in:
parent
1e86043750
commit
e660b731d7
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Ajax::AnonymousBlockController < AjaxController
|
class Ajax::AnonymousBlockController < AjaxController
|
||||||
def create
|
def create
|
||||||
params.require :question
|
params.require :question
|
||||||
|
@ -7,7 +9,7 @@ class Ajax::AnonymousBlockController < AjaxController
|
||||||
AnonymousBlock.create!(
|
AnonymousBlock.create!(
|
||||||
user: current_user,
|
user: current_user,
|
||||||
identifier: AnonymousBlock.get_identifier(question.author_identifier),
|
identifier: AnonymousBlock.get_identifier(question.author_identifier),
|
||||||
question: question,
|
question: question
|
||||||
)
|
)
|
||||||
|
|
||||||
question.inboxes.first.destroy
|
question.inboxes.first.destroy
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Ajax::QuestionController < AjaxController
|
||||||
author_is_anonymous: author_is_anonymous,
|
author_is_anonymous: author_is_anonymous,
|
||||||
author_identifier: AnonymousBlock.get_identifier(request.ip),
|
author_identifier: AnonymousBlock.get_identifier(request.ip),
|
||||||
user: current_user,
|
user: current_user,
|
||||||
direct: params[:rcpt] != 'followers')
|
direct: params[:rcpt] != "followers")
|
||||||
rescue ActiveRecord::RecordInvalid => e
|
rescue ActiveRecord::RecordInvalid => e
|
||||||
Sentry.capture_exception(e)
|
Sentry.capture_exception(e)
|
||||||
@response[:status] = :rec_inv
|
@response[:status] = :rec_inv
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AnonymousBlock < ApplicationRecord
|
class AnonymousBlock < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :question, optional: true
|
belongs_to :question, optional: true
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RenameAuthorEmailToAuthorIdentifier < ActiveRecord::Migration[6.1]
|
class RenameAuthorEmailToAuthorIdentifier < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
rename_column :questions, :author_email, :author_identifier
|
rename_column :questions, :author_email, :author_identifier
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class CreateAnonymousBlocks < ActiveRecord::Migration[6.1]
|
class CreateAnonymousBlocks < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
create_table :anonymous_blocks do |t|
|
create_table :anonymous_blocks do |t|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
|
describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
|
||||||
|
|
|
@ -266,7 +266,7 @@ describe Ajax::QuestionController, :ajax_controller, type: :controller do
|
||||||
AnonymousBlock.create(
|
AnonymousBlock.create(
|
||||||
user: target_user,
|
user: target_user,
|
||||||
identifier: identifier,
|
identifier: identifier,
|
||||||
question: dummy_question,
|
question: dummy_question
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue