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" if user_signed_in? && params[:rcpt] == "followers"
UseCase::Question::CreateFollowers.call( UseCase::Question::CreateFollowers.call(
source_user_id: current_user.id, source_user_id: current_user.id,
content: params[:question], content: params[:question],
author_identifier: AnonymousBlock.get_identifier(request.ip) author_identifier: AnonymousBlock.get_identifier(request.ip)
) )
return return
end end
UseCase::Question::Create.call( UseCase::Question::Create.call(
source_user_id: user_signed_in? ? current_user.id : nil, source_user_id: user_signed_in? ? current_user.id : nil,
target_user_id: params[:rcpt], target_user_id: params[:rcpt],
content: params[:question], content: params[:question],
anonymous: params[:anonymousQuestion], anonymous: params[:anonymousQuestion],
author_identifier: AnonymousBlock.get_identifier(request.ip) author_identifier: AnonymousBlock.get_identifier(request.ip)
) )
end end

View File

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

View File

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

View File

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