[Feature] Email collect message hooks (#331)

- Add email collect hook on creating conversation
- Merge contact if it already exist
This commit is contained in:
Sojan Jose
2020-01-09 13:06:40 +05:30
committed by Pranav Raj S
parent 59d4eaeca7
commit 722f540b03
68 changed files with 1111 additions and 544 deletions

View File

@@ -0,0 +1,6 @@
class AddTemplateTypeToMessages < ActiveRecord::Migration[6.0]
def change
add_column :messages, :content_type, :integer, default: '0'
add_column :messages, :content_attributes, :json, default: {}
end
end

View File

@@ -0,0 +1,14 @@
class AddContactInboxToConversation < ActiveRecord::Migration[6.0]
def change
add_reference(:conversations, :contact_inbox, foreign_key: true, index: true)
::Conversation.all.each do |conversation|
contact_inbox = ::ContactInbox.find_by(
contact_id: conversation.contact_id,
inbox_id: conversation.inbox_id
)
conversation.update!(contact_inbox_id: contact_inbox.id) if contact_inbox
end
end
end