FEATURE: add option to send individual report PM to group members (#369)
This change adds an option to the Schedule a PM with Data Explorer results script, which when selected will send individual PMs to each group member selected in the Send to User, Group or Email field. When this field is not checked, the functionality for groups will work as it did before (ie. send a single PM to the group).
This commit is contained in:
@@ -175,6 +175,17 @@ describe DiscourseDataExplorer::ReportGenerator do
|
||||
expect(result[2]["target_emails"]).to eq(["john@doe.com"])
|
||||
end
|
||||
|
||||
it "extracts users from group when option is selected" do
|
||||
Fabricate(:query_group, query: query, group: group)
|
||||
DiscourseDataExplorer::ResultToMarkdown.expects(:convert).returns("le table")
|
||||
freeze_time
|
||||
|
||||
result =
|
||||
described_class.generate(query.id, query_params, [group.name], { users_from_group: true })
|
||||
expect(result.length).to eq(1)
|
||||
expect(result[0]["target_usernames"]).to eq([user.username])
|
||||
end
|
||||
|
||||
it "works with attached csv file" do
|
||||
SiteSetting.personal_message_enabled_groups = group.id
|
||||
DiscourseDataExplorer::ResultToMarkdown.expects(:convert).returns("le table")
|
||||
|
||||
Reference in New Issue
Block a user