chore: Improve location display in sidebar (#1509)
- Log IP Address on widget load - Save country code to contact
This commit is contained in:
@@ -62,9 +62,12 @@ class Channel::WebWidget < ApplicationRecord
|
||||
"
|
||||
end
|
||||
|
||||
def create_contact_inbox
|
||||
def create_contact_inbox(additional_attributes = {})
|
||||
ActiveRecord::Base.transaction do
|
||||
contact = inbox.account.contacts.create!(name: ::Haikunator.haikunate(1000))
|
||||
contact = inbox.account.contacts.create!(
|
||||
name: ::Haikunator.haikunate(1000),
|
||||
additional_attributes: additional_attributes
|
||||
)
|
||||
contact_inbox = ::ContactInbox.create!(
|
||||
contact_id: contact.id,
|
||||
inbox_id: inbox.id,
|
||||
|
||||
@@ -38,9 +38,8 @@ class Contact < ApplicationRecord
|
||||
has_many :messages, as: :sender, dependent: :destroy
|
||||
|
||||
before_validation :prepare_email_attribute
|
||||
after_create_commit :dispatch_create_event
|
||||
after_create_commit :dispatch_create_event, :ip_lookup
|
||||
after_update_commit :dispatch_update_event
|
||||
after_commit :ip_lookup
|
||||
|
||||
def get_source_id(inbox_id)
|
||||
contact_inboxes.find_by!(inbox_id: inbox_id).source_id
|
||||
|
||||
Reference in New Issue
Block a user