a1452d7d89
* Avoid extra string alocation as join will always return string * Fix indentation * Sprinkle frozen string literal true
31 lines
520 B
Ruby
31 lines
520 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Integrations::Facebook::DeliveryStatus
|
|
|
|
def initialize(params)
|
|
@params = params
|
|
end
|
|
|
|
def perform
|
|
update_message_status
|
|
end
|
|
|
|
private
|
|
|
|
def sender_id
|
|
@params.sender['id']
|
|
end
|
|
|
|
def contact_id
|
|
@contact ||= ::Contact.find_by(source_id: sender_id)
|
|
end
|
|
|
|
def conversation
|
|
@conversation ||= ::Conversation.find_by(sender_id: contact_id)
|
|
end
|
|
|
|
def update_message_status
|
|
conversation.user_last_seen_at = @params.at
|
|
conversation.save!
|
|
end
|
|
end
|