mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:09:53 +01:00
Fix lint errors
This commit is contained in:
parent
d9ff4d5765
commit
22a66f4d1a
4 changed files with 11 additions and 14 deletions
|
@ -1,6 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "digest"
|
||||
require "errors"
|
||||
require "use_case/question/create"
|
||||
require "use_case/question/create_followers"
|
||||
|
@ -44,18 +43,18 @@ class Ajax::QuestionController < AjaxController
|
|||
|
||||
if user_signed_in? && params[:rcpt] == "followers"
|
||||
UseCase::Question::CreateFollowers.call(
|
||||
source_user_id: current_user.id,
|
||||
content: params[:question],
|
||||
source_user_id: current_user.id,
|
||||
content: params[:question],
|
||||
author_identifier: AnonymousBlock.get_identifier(request.ip)
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
UseCase::Question::Create.call(
|
||||
source_user_id: user_signed_in? ? current_user.id : nil,
|
||||
target_user_id: params[:rcpt],
|
||||
content: params[:question],
|
||||
anonymous: params[:anonymousQuestion],
|
||||
source_user_id: user_signed_in? ? current_user.id : nil,
|
||||
target_user_id: params[:rcpt],
|
||||
content: params[:question],
|
||||
anonymous: params[:anonymousQuestion],
|
||||
author_identifier: AnonymousBlock.get_identifier(request.ip)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -42,10 +42,8 @@ module UseCase
|
|||
raise Errors::BadRequest.new("anonymous must be set to true")
|
||||
end
|
||||
|
||||
if !target_user.privacy_allow_anonymous_questions && anonymous
|
||||
# The target user does not want questions from strangers
|
||||
raise Errors::Forbidden.new("no anonymous questions allowed")
|
||||
end
|
||||
# The target user does not want questions from strangers
|
||||
raise Errors::Forbidden.new("no anonymous questions allowed") if !target_user.privacy_allow_anonymous_questions && anonymous
|
||||
end
|
||||
|
||||
def check_blocks
|
||||
|
@ -62,7 +60,7 @@ module UseCase
|
|||
return
|
||||
end
|
||||
|
||||
source_user.increment!(:asked_count)
|
||||
source_user.increment(:asked_count)
|
||||
end
|
||||
|
||||
def filtered?(question)
|
||||
|
|
|
@ -29,7 +29,7 @@ module UseCase
|
|||
private
|
||||
|
||||
def increment_asked_count
|
||||
source_user.increment!(:asked_count)
|
||||
source_user.increment(:asked_count)
|
||||
end
|
||||
|
||||
def source_user
|
||||
|
|
|
@ -48,7 +48,7 @@ describe Ajax::QuestionController, :ajax_controller, type: :controller do
|
|||
include_examples "returns the expected response"
|
||||
end
|
||||
|
||||
shared_examples "enqueues a QuestionWorker job" do |expected_rcpt|
|
||||
shared_examples "enqueues a QuestionWorker job" do |_expected_rcpt|
|
||||
it "enqueues a QuestionWorker job" do
|
||||
allow(QuestionWorker).to receive(:perform_async)
|
||||
subject
|
||||
|
|
Loading…
Reference in a new issue