مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-22 15:48:18 +00:00
initial commit from appmail
هذا الالتزام موجود في:
28
app/jobs/send_webhook_job.rb
Normal file
28
app/jobs/send_webhook_job.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class SendWebhookJob < Postal::Job
|
||||
|
||||
def perform
|
||||
if server = Server.find(params['server_id'])
|
||||
new_items = {}
|
||||
if params['payload']
|
||||
for key, value in params['payload']
|
||||
if key.to_s =~ /\A\_(\w+)/
|
||||
begin
|
||||
new_items[$1] = server.message_db.message(value.to_i).webhook_hash
|
||||
rescue Postal::MessageDB::Message::NotFound
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
new_items.each do |key, value|
|
||||
params['payload'].delete("_#{key}")
|
||||
params['payload'][key] = value
|
||||
end
|
||||
|
||||
WebhookRequest.trigger(server, params['event'], params['payload'])
|
||||
else
|
||||
log "Couldn't find server with ID #{params['server_id']}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
المرجع في مشكلة جديدة
حظر مستخدم