Merge branch 'develop' into feat/voice-as-twilio-capability
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
# description :string
|
||||
# name :string
|
||||
# outgoing_url :string
|
||||
# secret :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
@@ -21,6 +22,8 @@ class AgentBot < ApplicationRecord
|
||||
include AccessTokenable
|
||||
include Avatarable
|
||||
|
||||
include WebhookSecretable
|
||||
|
||||
scope :accessible_to, lambda { |account|
|
||||
account_id = account&.id
|
||||
where(account_id: [nil, account_id])
|
||||
@@ -63,3 +66,5 @@ class AgentBot < ApplicationRecord
|
||||
account.nil?
|
||||
end
|
||||
end
|
||||
|
||||
AgentBot.include_mod_with('Audit::AgentBot')
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
# hmac_mandatory :boolean default(FALSE)
|
||||
# hmac_token :string
|
||||
# identifier :string
|
||||
# secret :string
|
||||
# webhook_url :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
@@ -26,6 +27,7 @@ class Channel::Api < ApplicationRecord
|
||||
|
||||
has_secure_token :identifier
|
||||
has_secure_token :hmac_token
|
||||
include WebhookSecretable
|
||||
validate :ensure_valid_agent_reply_time_window
|
||||
validates :webhook_url, length: { maximum: Limits::URL_LENGTH_LIMIT }
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
module WebhookSecretable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_secure_token :secret
|
||||
encrypts :secret if Chatwoot.encryption_configured?
|
||||
end
|
||||
|
||||
def reset_secret!
|
||||
regenerate_secret
|
||||
reload
|
||||
end
|
||||
end
|
||||
@@ -22,8 +22,7 @@ class Webhook < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :inbox, optional: true
|
||||
|
||||
has_secure_token :secret
|
||||
encrypts :secret if Chatwoot.encryption_configured?
|
||||
include WebhookSecretable
|
||||
|
||||
validates :account_id, presence: true
|
||||
validates :url, uniqueness: { scope: [:account_id] }, format: URI::DEFAULT_PARSER.make_regexp(%w[http https])
|
||||
|
||||
Reference in New Issue
Block a user