Fix lint errors
This commit is contained in:
parent
1216c249e8
commit
72906ca549
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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}"
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue