mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 19:59:07 +01:00
Add block checks into User#answer
This commit is contained in:
parent
e9fa3b83b2
commit
65309edd8f
1 changed files with 3 additions and 0 deletions
|
@ -106,6 +106,9 @@ class User < ApplicationRecord
|
||||||
# @param question [Question] the question to answer
|
# @param question [Question] the question to answer
|
||||||
# @param content [String] the answer content
|
# @param content [String] the answer content
|
||||||
def answer(question, content)
|
def answer(question, content)
|
||||||
|
raise Errors::AnsweringOtherBlockedSelf if question.user.blocking?(self)
|
||||||
|
raise Errors::AnsweringSelfBlockedOther if self.blocking?(question.user)
|
||||||
|
|
||||||
Answer.create!(content: content,
|
Answer.create!(content: content,
|
||||||
user: self,
|
user: self,
|
||||||
question: question)
|
question: question)
|
||||||
|
|
Loading…
Reference in a new issue