Chatwoot/app/models/contact.rb
Sojan Jose ba8f055802
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
2019-10-21 00:40:18 +05:30

21 lines
457 B
Ruby

class Contact < ApplicationRecord
include Pubsubable
validates :account_id, presence: true
validates :inbox_id, presence: true
belongs_to :account
belongs_to :inbox
has_many :conversations, dependent: :destroy
mount_uploader :avatar, AvatarUploader
def push_event_data
{
id: id,
name: name,
thumbnail: avatar.thumb.url,
channel: inbox.try(:channel).try(:name),
pubsub_token: pubsub_token
}
end
end