diff --git a/app/models/user.rb b/app/models/user.rb index 6ae0b3cc..eac5f9f1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -120,6 +120,9 @@ class User < ApplicationRecord # smiles an answer # @param answer [Answer] the answer to smile def smile(answer) + raise Errors::ReactingSelfBlockedOther if self.blocking?(answer.user) + raise Errors::ReactingOtherBlockedSelf if answer.user.blocking?(self) + Smile.create!(user: self, answer: answer) end diff --git a/lib/errors.rb b/lib/errors.rb index a56cb778..b577491e 100644 --- a/lib/errors.rb +++ b/lib/errors.rb @@ -79,5 +79,11 @@ module Errors class CommentingOtherBlockedSelf < OtherBlockedSelf end + + class ReactingSelfBlockedOther < SelfBlockedOther + end + + class ReactingOtherBlockedSelf < OtherBlockedSelf + end # endregion end