FIX: Ensure group-filtered group user event webhooks fire (#21254)

Group user event webhooks filtered by group fail silently
because the `group_ids` job arg wasn't being passed into the job.

This change add's `group_ids` to the `EmitWebHookEvent` jobs queued for
`user_added_to_group` and `user_removed_from_group` events.
This commit is contained in:
Selase Krakani
2023-04-26 22:38:28 +00:00
committed by GitHub
parent 3c4241c0b6
commit 37cc056c1b
3 changed files with 8 additions and 0 deletions

View File

@ -558,7 +558,10 @@ RSpec.describe WebHook do
job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first
expect(job_args["event_name"]).to eq("user_added_to_group")
expect(job_args["group_ids"]).to contain_exactly(group.id)
payload = JSON.parse(job_args["payload"])
expect(payload["group_id"]).to eq(group.id)
expect(payload["user_id"]).to eq(user.id)
expect(payload["notification_level"]).to eq(group.default_notification_level)
@ -577,7 +580,10 @@ RSpec.describe WebHook do
job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first
expect(job_args["event_name"]).to eq("user_removed_from_group")
expect(job_args["group_ids"]).to contain_exactly(group.id)
payload = JSON.parse(job_args["payload"])
expect(payload["group_id"]).to eq(group.id)
expect(payload["user_id"]).to eq(user.id)
end