fix: Handle application errors in Sentry (#1982)
- Handle notification errors for attachment messages - Fix empty identifiers being passed - Fix 404 when invalid source id - Handle webhook exceptions
This commit is contained in:
@@ -34,7 +34,9 @@ class ContactIdentifyAction
|
||||
|
||||
def update_contact
|
||||
custom_attributes = params[:custom_attributes] ? @contact.custom_attributes.merge(params[:custom_attributes]) : @contact.custom_attributes
|
||||
@contact.update!(params.slice(:name, :email, :identifier).merge({ custom_attributes: custom_attributes }))
|
||||
# blank identifier or email will throw unique index error
|
||||
# TODO: replace reject { |_k, v| v.blank? } with compact_blank when rails is upgraded
|
||||
@contact.update!(params.slice(:name, :email, :identifier).reject { |_k, v| v.blank? }.merge({ custom_attributes: custom_attributes }))
|
||||
ContactAvatarJob.perform_later(@contact, params[:avatar_url]) if params[:avatar_url].present?
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class Api::V1::Widget::BaseController < ApplicationController
|
||||
@contact_inbox = @web_widget.inbox.contact_inboxes.find_by(
|
||||
source_id: auth_token_params[:source_id]
|
||||
)
|
||||
@contact = @contact_inbox.contact
|
||||
@contact = @contact_inbox&.contact
|
||||
raise ActiveRecord::RecordNotFound unless @contact
|
||||
end
|
||||
|
||||
def create_conversation
|
||||
|
||||
@@ -6,7 +6,7 @@ class ApplicationMailbox < ActionMailbox::Base
|
||||
def self.reply_mail?
|
||||
proc do |inbound_mail_obj|
|
||||
is_a_reply_email = false
|
||||
inbound_mail_obj.mail.to.each do |email|
|
||||
inbound_mail_obj.mail.to&.each do |email|
|
||||
username = email.split('@')[0]
|
||||
match_result = username.match(REPLY_EMAIL_USERNAME_PATTERN)
|
||||
if match_result
|
||||
@@ -21,7 +21,7 @@ class ApplicationMailbox < ActionMailbox::Base
|
||||
def self.support_mail?
|
||||
proc do |inbound_mail_obj|
|
||||
is_a_support_email = false
|
||||
inbound_mail_obj.mail.to.each do |email|
|
||||
inbound_mail_obj.mail.to&.each do |email|
|
||||
channel = Channel::Email.find_by('email = ? OR forward_to_email = ?', email, email)
|
||||
if channel.present?
|
||||
is_a_support_email = true
|
||||
|
||||
@@ -70,7 +70,7 @@ class Notification < ApplicationRecord
|
||||
I18n.t(
|
||||
'notifications.notification_title.assigned_conversation_new_message',
|
||||
display_id: conversation.display_id,
|
||||
content: primary_actor.content.truncate_words(10)
|
||||
content: primary_actor.content&.truncate_words(10)
|
||||
)
|
||||
when 'conversation_mention'
|
||||
I18n.t('notifications.notification_title.conversation_mention', display_id: conversation.display_id, name: secondary_actor.name)
|
||||
|
||||
Reference in New Issue
Block a user