Send Message Action only sends to one recipient

Environment

Discourse Version: 2.7.0.beta1

Plugin Commit: d3e34a5be26da6991f24f5ae541d8eff6554acc7

Other Plugins

Steps to Reproduce

  1. Create a wizard that DMs two groups, ie:
[
	{
		"id": "message_group",
		"name": "Message Group",
		"save_submissions": true,
		"steps": [
			{
				"id": "step_1",
				"fields": [
					{
						"id": "step_1_field_1",
						"type": "text_only"
					},
					{
						"id": "step_1_field_2",
						"label": "Input",
						"type": "text"
					}
				]
			}
		],
		"actions": [
			{
				"id": "action_1",
				"run_after": "wizard_completion",
				"type": "send_message",
				"post_builder": true,
				"post_template": "Brand New Message!",
				"title": [
					{
						"type": "assignment",
						"output": "Here's a brand new message!",
						"output_type": "text",
						"output_connector": "set"
					}
				],
				"recipient": [
					{
						"type": "assignment",
						"output_type": "user",
						"output_connector": "set",
						"output": [
							"test-group-1",
							"test-group-2"
						]
					}
				]
			}
		]
	}
]
  1. Complete this wizard

  2. Note the message only went to one of the recipient groups

Example

Logs

cc @fzngagan - Hope you enjoyed your weekend, we’re having some trouble with this one

1 Like

@othomson
I’ll take a look at this soon

@othomson
Yes, the UI does suggest that adding multiple targets is allowed. But the code doesn’t handle that case properly.

I’m working on a PR for this fix, just need to run it through Angus. Also FYI, discourse doesn’t allow targetting multiple users, groups in PM for non-admins.

Will give you an update soon.

2 Likes

@othomson
Here’s a PR fixing the issue with some notes.

cc @angus

1 Like

This is merged now @othomson

2 Likes

Thanks @fzngagan !

2 Likes