FEATURE: Export chat messages to CSV file (#22113)

To export chat messages, go to `/admin/plugins/chat` and click the Create export 
button in the _Export chat messages_ section. You'll receive a direct message 
when the export is finished.

Currently, this exports all messages from the last 6 months, but not more than 
10000 messages.

This exports all chat messages, including messages from private channels and 
users' direct conversations. This also exports messages that were deleted.
This commit is contained in:
Andrei Prigorshnev
2023-06-21 16:13:36 +04:00
committed by GitHub
parent 720c0c6e4d
commit 3ea31f443c
12 changed files with 230 additions and 1 deletions

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
module Chat
module Admin
class ExportController < ::Admin::AdminController
requires_plugin Chat::PLUGIN_NAME
def export_messages
entity = "chat_message"
Jobs.enqueue(:export_csv_file, entity: entity, user_id: current_user.id)
StaffActionLogger.new(current_user).log_entity_export(entity)
end
end
end
end