[Bug] Remove toggle_typing API call for channels except Facebook (#211)

This commit is contained in:
Pranav Raj S
2019-11-17 14:15:05 +05:30
committed by GitHub
parent 127dd4cf61
commit 2ebc07b381
8 changed files with 81 additions and 78 deletions

View File

@@ -9,6 +9,10 @@ module Channel
has_one :inbox, as: :channel, dependent: :destroy
has_secure_token :website_token
def name
'Website'
end
def create_contact_inbox
ActiveRecord::Base.transaction do
contact = inbox.account.contacts.create!(name: ::Haikunator.haikunate(1000))

View File

@@ -1,22 +0,0 @@
class FacebookPage < ApplicationRecord
validates :account_id, presence: true
validates_uniqueness_of :page_id, scope: :account_id
mount_uploader :avatar, AvatarUploader
belongs_to :account
has_one :inbox, as: :channel, dependent: :destroy
before_destroy :unsubscribe
def name
'Facebook'
end
private
def unsubscribe
Facebook::Messenger::Subscriptions.unsubscribe(access_token: page_access_token)
rescue StandardError => e
true
end
end