Update question controller block handling to account for users not being logged in
This commit is contained in:
parent
c6c3c32260
commit
ea3bbcef17
|
@ -57,9 +57,6 @@ class Ajax::QuestionController < AjaxController
|
|||
else
|
||||
target_user = User.find_by(id: params[:rcpt])
|
||||
|
||||
raise Errors::AskingOtherBlockedSelf if target_user.blocking?(current_user)
|
||||
raise Errors::AskingSelfBlockedOther if current_user.blocking?(target_user)
|
||||
|
||||
if target_user.nil?
|
||||
@response[:status] = :not_found
|
||||
@response[:message] = I18n.t('messages.question.create.not_found')
|
||||
|
@ -67,6 +64,9 @@ class Ajax::QuestionController < AjaxController
|
|||
return
|
||||
end
|
||||
|
||||
raise Errors::AskingOtherBlockedSelf if target_user.blocking?(current_user)
|
||||
raise Errors::AskingSelfBlockedOther if current_user&.blocking?(target_user)
|
||||
|
||||
if !target_user.privacy_allow_anonymous_questions && question.author_is_anonymous
|
||||
question.delete
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue