Prevent errors in `User#answer` when asking anonymous questions
This commit is contained in:
parent
14e84fd47c
commit
b657894576
|
@ -107,7 +107,7 @@ class User < ApplicationRecord
|
|||
# @param content [String] the answer content
|
||||
def answer(question, content)
|
||||
# rubocop:disable Style/RedundantSelf
|
||||
raise Errors::AnsweringOtherBlockedSelf if question.user.blocking?(self)
|
||||
raise Errors::AnsweringOtherBlockedSelf if question.user&.blocking?(self)
|
||||
raise Errors::AnsweringSelfBlockedOther if self.blocking?(question.user)
|
||||
# rubocop:enable Style/RedundantSelf
|
||||
|
||||
|
|
Loading…
Reference in New Issue