diff --git a/app/models/group.rb b/app/models/group.rb index 5e63d19b97d..741ae34e265 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -810,6 +810,7 @@ class Group < ActiveRecord::Base :user_removed_from_group, id: group_user.id, payload: payload, + group_ids: [self.id], ) end diff --git a/config/initializers/012-web_hook_events.rb b/config/initializers/012-web_hook_events.rb index cf769d96da3..d7a7e2979b8 100644 --- a/config/initializers/012-web_hook_events.rb +++ b/config/initializers/012-web_hook_events.rb @@ -100,6 +100,7 @@ DiscourseEvent.on(:user_added_to_group) do |user, group, options| group_user, :user_added_to_group, WebHookGroupUserSerializer, + group_ids: [group.id], ) end diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb index 2752997d846..4ededd18a81 100644 --- a/spec/models/web_hook_spec.rb +++ b/spec/models/web_hook_spec.rb @@ -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