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
|
# smiles an answer
|
||||||
# @param answer [Answer] the answer to smile
|
# @param answer [Answer] the answer to smile
|
||||||
def smile(answer)
|
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)
|
Smile.create!(user: self, answer: answer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -79,5 +79,11 @@ module Errors
|
||||||
|
|
||||||
class CommentingOtherBlockedSelf < OtherBlockedSelf
|
class CommentingOtherBlockedSelf < OtherBlockedSelf
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ReactingSelfBlockedOther < SelfBlockedOther
|
||||||
|
end
|
||||||
|
|
||||||
|
class ReactingOtherBlockedSelf < OtherBlockedSelf
|
||||||
|
end
|
||||||
# endregion
|
# endregion
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue