From bd0a4532a581952e570f1569d43731feb30147f7 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Thu, 9 Jun 2022 19:40:09 +0200 Subject: [PATCH] Disallow answering questions when blocked by its author --- app/models/inbox.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/inbox.rb b/app/models/inbox.rb index 458e9d63..81df46b7 100644 --- a/app/models/inbox.rb +++ b/app/models/inbox.rb @@ -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