chore: Contact import improvements (#7787)
- Ensure existing contact information is updated on data import - Refactor the existing job to make it more readable - Fixes issues with import files in the wrong encoding fixes: #7307
This commit is contained in:
@@ -1,16 +1,4 @@
|
||||
class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer
|
||||
def failed_records(resource)
|
||||
return unless smtp_config_set_or_development?
|
||||
|
||||
subject = 'Contact Import Completed'
|
||||
|
||||
@attachment_url = Rails.application.routes.url_helpers.rails_blob_url(resource.failed_records) if resource.failed_records.attached?
|
||||
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{resource.account.id}/contacts"
|
||||
@failed_contacts = resource.total_records - resource.processed_records
|
||||
@imported_contacts = resource.processed_records
|
||||
send_mail_with_liquid(to: admin_emails, subject: subject) and return
|
||||
end
|
||||
|
||||
def slack_disconnect
|
||||
return unless smtp_config_set_or_development?
|
||||
|
||||
@@ -43,6 +31,19 @@ class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer
|
||||
send_mail_with_liquid(to: admin_emails, subject: subject) and return
|
||||
end
|
||||
|
||||
def contact_import_complete(resource)
|
||||
return unless smtp_config_set_or_development?
|
||||
|
||||
subject = 'Contact Import Completed'
|
||||
|
||||
@action_url = Rails.application.routes.url_helpers.rails_blob_url(resource.failed_records) if resource.failed_records.attached?
|
||||
@action_url ||= "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{resource.account.id}/contacts"
|
||||
@meta = {}
|
||||
@meta['failed_contacts'] = resource.total_records - resource.processed_records
|
||||
@meta['imported_contacts'] = resource.processed_records
|
||||
send_mail_with_liquid(to: admin_emails, subject: subject) and return
|
||||
end
|
||||
|
||||
def contact_export_complete(file_url)
|
||||
return unless smtp_config_set_or_development?
|
||||
|
||||
@@ -56,4 +57,8 @@ class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer
|
||||
def admin_emails
|
||||
Current.account.administrators.pluck(:email)
|
||||
end
|
||||
|
||||
def liquid_locals
|
||||
super.merge({ meta: @meta })
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user