mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:19:52 +01:00
Disallow reacting to an answer when blocked by its author
This commit is contained in:
parent
b4e5037469
commit
b38ae50ba7
2 changed files with 9 additions and 0 deletions
|
@ -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 a new issue