Disallow commenting when blocked by the answer's author
This commit is contained in:
parent
bd0a4532a5
commit
b4e5037469
|
@ -150,6 +150,9 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def comment(answer, content)
|
||||
raise Errors::CommentingSelfBlockedOther if self.blocking?(answer.user)
|
||||
raise Errors::CommentingOtherBlockedSelf if answer.user.blocking?(self)
|
||||
|
||||
Comment.create!(user: self, answer: answer, content: content)
|
||||
end
|
||||
|
||||
|
|
|
@ -73,5 +73,11 @@ module Errors
|
|||
|
||||
class AnsweringSelfBlockedOther < SelfBlockedOther
|
||||
end
|
||||
|
||||
class CommentingSelfBlockedOther < SelfBlockedOther
|
||||
end
|
||||
|
||||
class CommentingOtherBlockedSelf < OtherBlockedSelf
|
||||
end
|
||||
# endregion
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue