2019-08-08 14:25:28 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ProcessQuoteService < BaseService
|
|
|
|
# Create notification for a quote
|
|
|
|
# @param [Status] status Quoting status
|
|
|
|
# @return [Status]
|
|
|
|
def call(status)
|
|
|
|
create_notification(status)
|
|
|
|
bump_potential_friendship(status)
|
|
|
|
end
|
2021-02-04 18:48:50 +00:00
|
|
|
|
2019-08-08 14:25:28 +01:00
|
|
|
private
|
2021-02-04 18:48:50 +00:00
|
|
|
|
2019-08-08 14:25:28 +01:00
|
|
|
def create_notification(status)
|
|
|
|
quoted_status = status.quote
|
|
|
|
|
|
|
|
if quoted_status.account.local?
|
|
|
|
LocalNotificationWorker.perform_async(quoted_status.account_id, status.id, status.class.name)
|
|
|
|
end
|
|
|
|
end
|
2021-02-04 18:48:50 +00:00
|
|
|
|
2019-08-08 14:25:28 +01:00
|
|
|
def bump_potential_friendship(status)
|
2021-02-04 18:48:50 +00:00
|
|
|
# ActivityTracker.increment('activity:interactions')
|
2019-08-08 14:25:28 +01:00
|
|
|
return if status.account.following?(status.quote.account_id)
|
|
|
|
PotentialFriendshipTracker.record(status.account_id, status.quote.account_id, :reblog)
|
|
|
|
end
|
2021-02-04 18:48:50 +00:00
|
|
|
|
2019-08-08 14:25:28 +01:00
|
|
|
end
|