mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 06:56:01 +08:00
FIX: strip webhook payload_url
This commit is contained in:
@ -13,6 +13,8 @@ class WebHook < ActiveRecord::Base
|
||||
validates_presence_of :last_delivery_status
|
||||
validates_presence_of :web_hook_event_types, unless: :wildcard_web_hook?
|
||||
|
||||
before_save :strip_url
|
||||
|
||||
def self.content_types
|
||||
@content_types ||= Enum.new('application/json' => 1,
|
||||
'application/x-www-form-urlencoded' => 2)
|
||||
@ -47,6 +49,10 @@ class WebHook < ActiveRecord::Base
|
||||
def self.enqueue_post_hooks(event, post, user = nil)
|
||||
WebHook.enqueue_hooks(:post, post_id: post.id, category_id: post&.topic&.category_id, event_name: event.to_s)
|
||||
end
|
||||
|
||||
def strip_url
|
||||
self.payload_url = (payload_url || "").strip.presence
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
Reference in New Issue
Block a user