Disallow answering questions when blocked by its author

This commit is contained in:
Karina Kwiatek 2022-06-09 19:40:09 +02:00 committed by Karina Kwiatek
parent 9f06b48569
commit bd0a4532a5
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,9 @@ class Inbox < ApplicationRecord
end
def answer(answer_content, user)
raise Errors::AnsweringOtherBlockedSelf if question.user.blocking?(user)
raise Errors::AnsweringSelfBlockedOther if user.blocking?(question.user)
answer = user.answer(self.question, answer_content)
self.destroy
answer