2019-08-14 09:48:44 +00:00
|
|
|
class Integrations::Facebook::DeliveryStatus
|
|
|
|
|
|
|
|
def initialize(params)
|
|
|
|
@params = params
|
|
|
|
end
|
|
|
|
|
|
|
|
def perform
|
|
|
|
update_message_status
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def sender_id
|
|
|
|
@params.sender['id']
|
|
|
|
end
|
|
|
|
|
2019-08-31 06:22:09 +00:00
|
|
|
def contact_id
|
|
|
|
@contact ||= ::Contact.find_by(source_id: sender_id)
|
|
|
|
end
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
def conversation
|
2019-08-31 06:22:09 +00:00
|
|
|
@conversation ||= ::Conversation.find_by(sender_id: contact_id)
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update_message_status
|
|
|
|
conversation.user_last_seen_at = @params.at
|
|
|
|
conversation.save!
|
|
|
|
end
|
|
|
|
end
|