Prevent blocked users from reacting on comments
This commit is contained in:
parent
25ed1e4605
commit
e64d4f3ca7
|
@ -142,6 +142,11 @@ class User < ApplicationRecord
|
||||||
# smiles a comment
|
# smiles a comment
|
||||||
# @param comment [Comment] the comment to smile
|
# @param comment [Comment] the comment to smile
|
||||||
def smile_comment(comment)
|
def smile_comment(comment)
|
||||||
|
# rubocop:disable Style/RedundantSelf
|
||||||
|
raise Errors::ReactingSelfBlockedOther if self.blocking?(comment.user)
|
||||||
|
raise Errors::ReactingOtherBlockedSelf if comment.user.blocking?(self)
|
||||||
|
# rubocop:enable Style/RedundantSelf
|
||||||
|
|
||||||
CommentSmile.create!(user: self, comment: comment)
|
CommentSmile.create!(user: self, comment: comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue