[Feature] Email collect message hooks (#331)
- Add email collect hook on creating conversation - Merge contact if it already exist
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user