Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit eb22886

Browse files
committed
small refactor
1 parent 7345a54 commit eb22886

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/discourse_data_explorer/report_generator.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ def self.generate(query_id, query_params, recipients, opts = {})
66
query = DiscourseDataExplorer::Query.find(query_id)
77
return [] if !query || recipients.empty?
88

9-
recipients = filter_recipients_by_query_access(recipients, query, opts)
9+
recipients =
10+
filter_recipients_by_query_access(
11+
recipients,
12+
query,
13+
users_from_group: opts[:users_from_group],
14+
)
1015
params = params_to_hash(query_params)
1116

1217
result = DataExplorer.run_query(query, params)
@@ -114,11 +119,10 @@ def self.create_csv_upload(query, result)
114119
UploadCreator.new(tmp, tmp_filename, type: "csv_export").create_for(Discourse.system_user.id)
115120
end
116121

117-
def self.filter_recipients_by_query_access(recipients, query, opts)
122+
def self.filter_recipients_by_query_access(recipients, query, users_from_group: false)
118123
users = User.where(username: recipients)
119124
groups = Group.where(name: recipients)
120125
emails = recipients - users.pluck(:username) - groups.pluck(:name)
121-
users_from_group = opts[:users_from_group] || false
122126
result = []
123127

124128
users.each do |user|

0 commit comments

Comments
 (0)