mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 08:33:45 +08:00
07a9163ea8
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.
13 lines
278 B
Ruby
13 lines
278 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class DeleteUserMessages < ::Jobs::Base
|
|
def execute(args)
|
|
return if args[:user_id].nil?
|
|
|
|
ChatMessageDestroyer.new
|
|
.destroy_in_batches(ChatMessage.with_deleted.where(user_id: args[:user_id]))
|
|
end
|
|
end
|
|
end
|