mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: correctly take category/group filters into csv export (#9300)
This commit is contained in:
@@ -7,6 +7,10 @@ module Jobs
|
||||
class ExportCsvFile < ::Jobs::Base
|
||||
sidekiq_options retry: false
|
||||
|
||||
attr_accessor :extra
|
||||
attr_accessor :current_user
|
||||
attr_accessor :entity
|
||||
|
||||
HEADER_ATTRS_FOR ||= HashWithIndifferentAccess.new(
|
||||
user_archive: ['topic_title', 'categories', 'is_pm', 'post', 'like_count', 'reply_count', 'url', 'created_at'],
|
||||
user_list: ['id', 'name', 'username', 'email', 'title', 'created_at', 'last_seen_at', 'last_posted_at', 'last_emailed_at', 'trust_level', 'approved', 'suspended_at', 'suspended_till', 'silenced_till', 'active', 'admin', 'moderator', 'ip_address', 'staged', 'secondary_emails'],
|
||||
@@ -180,8 +184,13 @@ module Jobs
|
||||
|
||||
@extra[:start_date] = @extra[:start_date].to_date.beginning_of_day if @extra[:start_date].is_a?(String)
|
||||
@extra[:end_date] = @extra[:end_date].to_date.end_of_day if @extra[:end_date].is_a?(String)
|
||||
@extra[:category_id] = @extra[:category_id].present? ? @extra[:category_id].to_i : nil
|
||||
@extra[:group_id] = @extra[:group_id].present? ? @extra[:group_id].to_i : nil
|
||||
@extra[:filters] = {}
|
||||
if @extra[:category_id].present?
|
||||
@extra[:filters][:category] = @extra[:category_id].to_i
|
||||
end
|
||||
if @extra[:group_id].present?
|
||||
@extra[:filters][:group] = @extra[:group_id].to_i
|
||||
end
|
||||
|
||||
report = Report.find(@extra[:name], @extra)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user