mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 18:29:52 +01:00
Update question controller block handling to account for users not being logged in
This commit is contained in:
parent
c6c3c32260
commit
ea3bbcef17
1 changed files with 3 additions and 3 deletions
|
@ -57,9 +57,6 @@ class Ajax::QuestionController < AjaxController
|
||||||
else
|
else
|
||||||
target_user = User.find_by(id: params[:rcpt])
|
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?
|
if target_user.nil?
|
||||||
@response[:status] = :not_found
|
@response[:status] = :not_found
|
||||||
@response[:message] = I18n.t('messages.question.create.not_found')
|
@response[:message] = I18n.t('messages.question.create.not_found')
|
||||||
|
@ -67,6 +64,9 @@ class Ajax::QuestionController < AjaxController
|
||||||
return
|
return
|
||||||
end
|
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
|
if !target_user.privacy_allow_anonymous_questions && question.author_is_anonymous
|
||||||
question.delete
|
question.delete
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue