Fix lint errors

This commit is contained in:
Karina Kwiatek 2022-01-24 22:46:11 +01:00 committed by Karina Kwiatek
parent 1216c249e8
commit 72906ca549
4 changed files with 14 additions and 14 deletions

View File

@ -43,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

View File

@ -26,7 +26,7 @@ class AjaxController < ApplicationController
@response = {
success: false,
message: e.message,
status: e.code
status: e.code
}
return_response

View File

@ -12,9 +12,9 @@ class QuestionWorker
question = Question.find(question_id)
user.followers.each do |f|
if MuteRule.where(user: f).none? { |rule| rule.applies_to? question }
Inbox.create(user_id: f.id, question_id: question_id, new: true)
end
next if MuteRule.where(user: f).any? { |rule| rule.applies_to? question }
Inbox.create(user_id: f.id, question_id: question_id, new: true)
end
rescue StandardError => e
logger.info "failed to ask question: #{e.message}"

View File

@ -48,10 +48,10 @@ module UseCase
end
def check_blocks
if source_user_id.present?
raise Errors::AskingOtherBlockedSelf if target_user.blocking?(source_user)
raise Errors::AskingSelfBlockedOther if source_user.blocking?(target_user)
end
return if source_user_id.blank?
raise Errors::AskingOtherBlockedSelf if target_user.blocking?(source_user)
raise Errors::AskingSelfBlockedOther if source_user.blocking?(target_user)
end
def increment_asked_count