chore: Sidebar icons for new inboxes (#3016)
- Sidebar icons for line and telegram inboxes - Sentry fix for contact IP lookup job
This commit is contained in:
@@ -148,6 +148,14 @@ class Messages::Facebook::MessageBuilder
|
||||
}
|
||||
end
|
||||
|
||||
def process_contact_params_result(result)
|
||||
{
|
||||
name: "#{result['first_name'] || 'John'} #{result['last_name'] || 'Doe'}",
|
||||
account_id: @inbox.account_id,
|
||||
remote_avatar_url: result['profile_pic'] || ''
|
||||
}
|
||||
end
|
||||
|
||||
def contact_params
|
||||
begin
|
||||
k = Koala::Facebook::API.new(@inbox.channel.page_access_token) if @inbox.facebook?
|
||||
@@ -155,14 +163,15 @@ class Messages::Facebook::MessageBuilder
|
||||
rescue Koala::Facebook::AuthenticationError
|
||||
@inbox.channel.authorization_error!
|
||||
raise
|
||||
rescue Koala::Facebook::ClientError => e
|
||||
result = {}
|
||||
# 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
|
||||
Sentry.capture_exception(e) unless outgoing_echo?
|
||||
rescue StandardError => e
|
||||
result = {}
|
||||
Sentry.capture_exception(e)
|
||||
end
|
||||
{
|
||||
name: "#{result['first_name'] || 'John'} #{result['last_name'] || 'Doe'}",
|
||||
account_id: @inbox.account_id,
|
||||
remote_avatar_url: result['profile_pic'] || ''
|
||||
}
|
||||
process_contact_params_result(result)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<a href="#" :class="computedChildClass(child)">
|
||||
<div class="wrap">
|
||||
<i
|
||||
v-if="computedInboxClass(child)"
|
||||
v-if="menuItem.key === 'inbox'"
|
||||
class="inbox-icon"
|
||||
:class="computedInboxClass(child)"
|
||||
/>
|
||||
|
||||
@@ -22,7 +22,10 @@ export const getInboxClassByType = (type, phoneNumber) => {
|
||||
case INBOX_TYPES.EMAIL:
|
||||
return 'ion-ios-email';
|
||||
|
||||
case INBOX_TYPES.TELEGRAM:
|
||||
return 'ion-ios-navigate';
|
||||
|
||||
default:
|
||||
return '';
|
||||
return 'ion-ios-chatbubble';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ export const INBOX_TYPES = {
|
||||
TWILIO: 'Channel::TwilioSms',
|
||||
API: 'Channel::Api',
|
||||
EMAIL: 'Channel::Email',
|
||||
TELEGRAM: 'Channel::Telegram',
|
||||
LINE: 'Channel::Line',
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ class ContactIpLookupJob < ApplicationJob
|
||||
geocoder_result = Geocoder.search(ip).first
|
||||
return unless geocoder_result
|
||||
|
||||
contact.additional_attributes ||= {}
|
||||
contact.additional_attributes['city'] = geocoder_result.city
|
||||
contact.additional_attributes['country'] = geocoder_result.country
|
||||
contact.additional_attributes['country_code'] = geocoder_result.country_code
|
||||
@@ -34,7 +35,7 @@ class ContactIpLookupJob < ApplicationJob
|
||||
end
|
||||
|
||||
def get_contact_ip(contact)
|
||||
contact.additional_attributes['updated_at_ip'] || contact.additional_attributes['created_at_ip']
|
||||
contact.additional_attributes&.dig('updated_at_ip') || contact.additional_attributes&.dig('created_at_ip')
|
||||
end
|
||||
|
||||
def ensure_look_up_db
|
||||
|
||||
Reference in New Issue
Block a user