FEATURE: trigger webhook when a user added/removed in a group. (#12653)

Whenever a group is added or removed from a group a webhook event will get triggered if it's active.
This commit is contained in:
Vinoth Kannan
2021-04-08 21:16:34 +05:30
committed by GitHub
parent 38e7fe2770
commit 26d7eedf4c
8 changed files with 73 additions and 2 deletions
@@ -95,3 +95,8 @@ end
DiscourseEvent.on(:notification_created) do |notification|
WebHook.enqueue_object_hooks(:notification, notification, :notification_created, NotificationSerializer)
end
DiscourseEvent.on(:user_added_to_group) do |user, group, options|
group_user = GroupUser.find_by(user: user, group: group)
WebHook.enqueue_object_hooks(:group_user, group_user, :user_added_to_group, WebHookGroupUserSerializer)
end