mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Deleting a user with their posts also deletes chat messages. (#19194)
This commit introduce a new API for registering callbacks, which we'll execute when a user gets destroyed, and the `delete_posts` opt is true. The chat plugin registers one callback and queues a job to destroy every message from that user in batches.
This commit is contained in:
@ -1138,6 +1138,17 @@ class Plugin::Instance
|
||||
HashtagAutocompleteService.register_type_in_context(type, context, priority)
|
||||
end
|
||||
|
||||
##
|
||||
# Register a block that will be called when the UserDestroyer runs
|
||||
# with the :delete_posts opt set to true. It's important to note that the block will
|
||||
# execute before any other :delete_posts actions, it allows us to manipulate flags
|
||||
# before agreeing with them. For example, discourse-akismet makes use of this
|
||||
#
|
||||
# @param {Block} callback to be called with the user, guardian, and the destroyer opts as arguments
|
||||
def register_user_destroyer_on_content_deletion_callback(callback)
|
||||
DiscoursePluginRegistry.register_user_destroyer_on_content_deletion_callback(callback, self)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def self.js_path
|
||||
|
Reference in New Issue
Block a user