2016-06-16 01:49:57 +08: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
|
|
|
|
|
|
|
|
transient post_hook: WebHookEventType.find_by(name: 'post')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types << transients[:post_hook]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:inactive_web_hook, from: :web_hook) do
|
|
|
|
active false
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:wildcard_web_hook, from: :web_hook) do
|
|
|
|
wildcard_web_hook true
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:topic_web_hook, from: :web_hook) do
|
|
|
|
transient topic_hook: WebHookEventType.find_by(name: 'topic')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:topic_hook]]
|
|
|
|
end
|
|
|
|
end
|
2017-03-16 14:44:09 +08:00
|
|
|
|
2018-05-18 15:01:36 +08:00
|
|
|
Fabricator(:post_web_hook, from: :web_hook) do
|
|
|
|
transient topic_hook: WebHookEventType.find_by(name: 'post')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:post_hook]]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-16 14:44:09 +08:00
|
|
|
Fabricator(:user_web_hook, from: :web_hook) do
|
|
|
|
transient user_hook: WebHookEventType.find_by(name: 'user')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:user_hook]]
|
|
|
|
end
|
|
|
|
end
|
2018-03-28 20:10:29 +08:00
|
|
|
|
|
|
|
Fabricator(:group_web_hook, from: :web_hook) do
|
|
|
|
transient group_hook: WebHookEventType.find_by(name: 'group')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:group_hook]]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:category_web_hook, from: :web_hook) do
|
|
|
|
transient category_hook: WebHookEventType.find_by(name: 'category')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:category_hook]]
|
|
|
|
end
|
|
|
|
end
|
2018-04-04 20:19:20 +08:00
|
|
|
|
|
|
|
Fabricator(:tag_web_hook, from: :web_hook) do
|
|
|
|
transient tag_hook: WebHookEventType.find_by(name: 'tag')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:tag_hook]]
|
|
|
|
end
|
|
|
|
end
|
2018-04-11 22:17:05 +08:00
|
|
|
|
|
|
|
Fabricator(:flag_web_hook, from: :web_hook) do
|
|
|
|
transient flag_hook: WebHookEventType.find_by(name: 'flag')
|
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
|
|
|
web_hook.web_hook_event_types = [transients[:flag_hook]]
|
|
|
|
end
|
|
|
|
end
|
2018-07-26 01:54:43 +08:00
|
|
|
|
2018-07-26 12:59:38 +08:00
|
|
|
Fabricator(:queued_post_web_hook, from: :web_hook) do
|
|
|
|
transient queued_post_hook: WebHookEventType.find_by(name: 'queued_post')
|
2018-07-26 01:54:43 +08:00
|
|
|
|
|
|
|
after_build do |web_hook, transients|
|
2018-07-26 12:59:38 +08:00
|
|
|
web_hook.web_hook_event_types = [transients[:queued_post_hook]]
|
2018-07-26 01:54:43 +08:00
|
|
|
end
|
|
|
|
end
|