2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-15 13:49:57 -04:00
|
|
|
Fabricator(:web_hook) do
|
|
|
|
payload_url "https://meta.discourse.org/webhook_listener"
|
|
|
|
content_type WebHook.content_types["application/json"]
|
|
|
|
wildcard_web_hook false
|
|
|
|
secret "my_lovely_secret_for_web_hook"
|
|
|
|
verify_certificate true
|
|
|
|
active true
|
|
|
|
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[post_created post_edited post_destroyed post_recovered])
|
|
|
|
end
|
2016-06-15 13:49:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:inactive_web_hook, from: :web_hook) { active false }
|
|
|
|
|
|
|
|
Fabricator(:wildcard_web_hook, from: :web_hook) { wildcard_web_hook true }
|
|
|
|
|
|
|
|
Fabricator(:topic_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(
|
|
|
|
name: %w[topic_created topic_revised topic_edited topic_destroyed topic_recovered],
|
|
|
|
)
|
|
|
|
end
|
2016-06-15 13:49:57 -04:00
|
|
|
end
|
2017-03-16 02:44:09 -04:00
|
|
|
|
2018-05-18 03:01:36 -04:00
|
|
|
Fabricator(:post_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[post_created post_edited post_destroyed post_recovered])
|
|
|
|
end
|
2018-05-18 03:01:36 -04:00
|
|
|
end
|
|
|
|
|
2017-03-16 02:44:09 -04:00
|
|
|
Fabricator(:user_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(
|
|
|
|
name: %w[
|
|
|
|
user_logged_in
|
|
|
|
user_logged_out
|
|
|
|
user_confirmed_email
|
|
|
|
user_created
|
|
|
|
user_approved
|
|
|
|
user_updated
|
|
|
|
user_destroyed
|
|
|
|
user_suspended
|
|
|
|
user_unsuspended
|
|
|
|
],
|
|
|
|
)
|
|
|
|
end
|
2017-03-16 02:44:09 -04:00
|
|
|
end
|
2018-03-28 08:10:29 -04:00
|
|
|
|
|
|
|
Fabricator(:group_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[group_created group_updated group_destroyed])
|
|
|
|
end
|
2018-03-28 08:10:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:category_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[category_created category_updated category_destroyed])
|
2018-03-28 08:10:29 -04:00
|
|
|
end
|
|
|
|
end
|
2018-04-04 08:19:20 -04:00
|
|
|
|
|
|
|
Fabricator(:tag_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[tag_created tag_updated tag_destroyed])
|
|
|
|
end
|
2018-04-04 08:19:20 -04:00
|
|
|
end
|
2018-04-11 10:17:05 -04:00
|
|
|
|
2019-01-03 12:03:01 -05:00
|
|
|
Fabricator(:reviewable_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[reviewable_created reviewable_updated])
|
2019-01-03 12:03:01 -05:00
|
|
|
end
|
|
|
|
end
|
2019-08-15 14:45:30 -04:00
|
|
|
|
|
|
|
Fabricator(:notification_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types = WebHookEventType.where(name: "notification_created")
|
2019-08-15 14:45:30 -04:00
|
|
|
end
|
|
|
|
end
|
2020-04-08 14:34:35 -04:00
|
|
|
|
|
|
|
Fabricator(:user_badge_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[user_badge_granted user_badge_revoked])
|
2020-04-08 14:34:35 -04:00
|
|
|
end
|
|
|
|
end
|
2021-04-08 11:46:34 -04:00
|
|
|
|
|
|
|
Fabricator(:group_user_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types =
|
|
|
|
WebHookEventType.where(name: %w[user_added_to_group user_removed_from_group])
|
2021-04-08 11:46:34 -04:00
|
|
|
end
|
|
|
|
end
|
2021-04-30 20:08:38 -04:00
|
|
|
|
|
|
|
Fabricator(:like_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types = WebHookEventType.where(name: "post_liked")
|
|
|
|
end
|
2021-04-30 20:08:38 -04:00
|
|
|
end
|
2022-02-22 04:57:18 -05:00
|
|
|
|
|
|
|
Fabricator(:user_promoted_web_hook, from: :web_hook) do
|
2023-10-08 23:35:31 -04:00
|
|
|
after_build do |web_hook|
|
|
|
|
web_hook.web_hook_event_types = WebHookEventType.where(name: "user_promoted")
|
2022-02-22 04:57:18 -05:00
|
|
|
end
|
|
|
|
end
|