chore: Return medium in inbox APIs (#3025)

Return medium in inbox APIs
This commit is contained in:
Sojan Jose
2021-09-16 16:51:06 +05:30
committed by GitHub
parent a0ffefad71
commit 0c3e8b6dbd
3 changed files with 6 additions and 1 deletions

View File

@@ -167,7 +167,7 @@ class Messages::Facebook::MessageBuilder
result = {} result = {}
# OAuthException, code: 100, error_subcode: 2018218, message: (#100) No profile available for this user # OAuthException, code: 100, error_subcode: 2018218, message: (#100) No profile available for this user
# We don't need to capture this error as we don't care about contact params in case of echo messages # We don't need to capture this error as we don't care about contact params in case of echo messages
Sentry.capture_exception(e) unless outgoing_echo? Sentry.capture_exception(e) unless @outgoing_echo
rescue StandardError => e rescue StandardError => e
result = {} result = {}
Sentry.capture_exception(e) Sentry.capture_exception(e)

View File

@@ -83,6 +83,10 @@ class Inbox < ApplicationRecord
channel_type == 'Channel::Email' channel_type == 'Channel::Email'
end end
def twilio?
channel_type == 'Channel::TwilioSms'
end
def inbox_type def inbox_type
channel.name channel.name
end end

View File

@@ -38,6 +38,7 @@ json.reauthorization_required resource.channel.try(:reauthorization_required?) i
## Twilio Attributes ## Twilio Attributes
json.phone_number resource.channel.try(:phone_number) json.phone_number resource.channel.try(:phone_number)
json.medium resource.channel.try(:medium) if resource.twilio?
## Email Channel Attributes ## Email Channel Attributes
json.forward_to_email resource.channel.try(:forward_to_email) json.forward_to_email resource.channel.try(:forward_to_email)