chore: Add support for message_templates in API inbox (#4835)

This commit is contained in:
Pranav Raj S
2022-06-10 18:40:29 +05:30
committed by GitHub
parent 9bac5873ef
commit 3f3ee6c34a
8 changed files with 44 additions and 25 deletions

View File

@@ -2,14 +2,15 @@
#
# Table name: channel_api
#
# id :bigint not null, primary key
# hmac_mandatory :boolean default(FALSE)
# hmac_token :string
# identifier :string
# webhook_url :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# id :bigint not null, primary key
# additional_attributes :jsonb
# hmac_mandatory :boolean default(FALSE)
# hmac_token :string
# identifier :string
# webhook_url :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
#
# Indexes
#
@@ -21,7 +22,7 @@ class Channel::Api < ApplicationRecord
include Channelable
self.table_name = 'channel_api'
EDITABLE_ATTRS = [:webhook_url].freeze
EDITABLE_ATTRS = [:webhook_url, { additional_attributes: {} }].freeze
has_secure_token :identifier
has_secure_token :hmac_token

View File

@@ -116,18 +116,19 @@ class Message < ApplicationRecord
def webhook_data
{
id: id,
content: content,
created_at: created_at,
message_type: message_type,
content_type: content_type,
private: private,
account: account.webhook_data,
additional_attributes: additional_attributes,
content_attributes: content_attributes,
source_id: source_id,
sender: sender.try(:webhook_data),
inbox: inbox.webhook_data,
content_type: content_type,
content: content,
conversation: conversation.webhook_data,
account: account.webhook_data
created_at: created_at,
id: id,
inbox: inbox.webhook_data,
message_type: message_type,
private: private,
sender: sender.try(:webhook_data),
source_id: source_id
}
end