Disallow reacting to an answer when blocked by its author
This commit is contained in:
parent
b4e5037469
commit
b38ae50ba7
|
@ -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
|
||||
|
||||
|
|
|
@ -79,5 +79,11 @@ module Errors
|
|||
|
||||
class CommentingOtherBlockedSelf < OtherBlockedSelf
|
||||
end
|
||||
|
||||
class ReactingSelfBlockedOther < SelfBlockedOther
|
||||
end
|
||||
|
||||
class ReactingOtherBlockedSelf < OtherBlockedSelf
|
||||
end
|
||||
# endregion
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue