Change sender_id to contact_id in conversations (#167)
* change sender_id to contact_id in conversations * Fix failing tests * Fix seeds * fix specs * Fix issues in facebook messenger
This commit is contained in:
@@ -5,7 +5,7 @@ class Account < ApplicationRecord
|
||||
has_many :inboxes, dependent: :destroy
|
||||
has_many :conversations, dependent: :destroy
|
||||
has_many :contacts, dependent: :destroy
|
||||
has_many :facebook_pages, dependent: :destroy
|
||||
has_many :facebook_pages, dependent: :destroy, class_name: '::Channel::FacebookPage'
|
||||
has_many :telegram_bots, dependent: :destroy
|
||||
has_many :canned_responses, dependent: :destroy
|
||||
has_one :subscription, dependent: :destroy
|
||||
|
||||
@@ -12,7 +12,7 @@ module Channel
|
||||
before_destroy :unsubscribe
|
||||
|
||||
def name
|
||||
`Facebook`
|
||||
'Facebook'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -6,7 +6,7 @@ class Contact < ApplicationRecord
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :inbox
|
||||
has_many :conversations, dependent: :destroy, foreign_key: :sender_id
|
||||
has_many :conversations, dependent: :destroy
|
||||
mount_uploader :avatar, AvatarUploader
|
||||
|
||||
def push_event_data
|
||||
|
||||
@@ -13,7 +13,7 @@ class Conversation < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :inbox
|
||||
belongs_to :assignee, class_name: 'User', optional: true
|
||||
belongs_to :sender, class_name: 'Contact'
|
||||
belongs_to :contact
|
||||
|
||||
has_many :messages, dependent: :destroy, autosave: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user