Remove notifications when banishing and deleting a user (#2039)
* Make remove_notifications a public method * Remove notifications when banishing or deleting
This commit is contained in:
parent
e45f9cca03
commit
f93af16fbe
2 changed files with 8 additions and 6 deletions
|
|
@ -185,18 +185,18 @@ class Comment < ApplicationRecord
|
|||
commentable.index!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_notifications
|
||||
Notification.update_notifications(self)
|
||||
end
|
||||
|
||||
def remove_notifications
|
||||
Notification.remove_all_without_delay(notifiable_id: id, notifiable_type: "Comment")
|
||||
Notification.remove_all_without_delay(notifiable_id: id, notifiable_type: "Comment", action: "Moderation")
|
||||
Notification.remove_all_without_delay(notifiable_id: id, notifiable_type: "Comment", action: "Reaction")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_notifications
|
||||
Notification.update_notifications(self)
|
||||
end
|
||||
|
||||
def send_to_moderator
|
||||
return if user && user.comments_count > 10
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ module Moderator
|
|||
comment.reactions.delete_all
|
||||
CacheBuster.new.bust_comment(comment.commentable, user.username)
|
||||
comment.delete
|
||||
comment.remove_notifications
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ module Moderator
|
|||
comment.reactions.delete_all
|
||||
CacheBuster.new.bust_comment(comment.commentable, comment.user.username)
|
||||
comment.delete
|
||||
comment.remove_notifications
|
||||
end
|
||||
CacheBuster.new.bust_article(article)
|
||||
article.remove_algolia_index
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue