mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-17 00:52:02 +00:00
* users can set up hooks for issue creation, update and deletion events, for any number of projects * hooks run in the context of the creating user, and only if the object in question is visible to that user * the actual HTTP call is done in ActiveJob * webhook calls are optionally signed the same way GitHub does Patch by Jens Krämer (user:jkraemer). git-svn-id: https://svn.redmine.org/redmine/trunk@24034 e93f8b46-1217-0410-a6f0-8f06a7374b81
17 lines
453 B
Ruby
17 lines
453 B
Ruby
# frozen_string_literal: true
|
|
|
|
class WebhookJob < ApplicationJob
|
|
def perform(hook_id, payload_json)
|
|
if hook = Webhook.find_by_id(hook_id)
|
|
if hook.user&.active?
|
|
User.current = hook.user
|
|
hook.call payload_json
|
|
else
|
|
Rails.logger.debug { "WebhookJob: user with id=#{hook.user_id} is not active" }
|
|
end
|
|
else
|
|
Rails.logger.debug { "WebhookJob: couldn't find hook with id=#{hook_id}" }
|
|
end
|
|
end
|
|
end
|