8155024b6a
https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html Fixes https://github.com/chatwoot/chatwoot/issues/4313
13 lines
430 B
Ruby
13 lines
430 B
Ruby
class ContactAvatarJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(contact, avatar_url)
|
|
avatar_file = Down.download(
|
|
avatar_url,
|
|
max_size: 15 * 1024 * 1024
|
|
)
|
|
contact.avatar.attach(io: avatar_file, filename: avatar_file.original_filename, content_type: avatar_file.content_type)
|
|
rescue Down::Error => e
|
|
Rails.logger.error "Exception: invalid avatar url #{avatar_url} : #{e.message}"
|
|
end
|
|
end
|