about summary refs log tree commit diff
path: root/app/services/publish_status_service.rb
blob: 737186a178eaa95585c6406fd1841835280d7da2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true
class PublishStatusService < BaseService
  def call(status)
    return if status.published?

    status.update!(published: true)

    ProcessMentionsService.new.call(status)

    LinkCrawlWorker.perform_in(rand(1..30).seconds, status.id) unless status.spoiler_text?
    DistributionWorker.perform_async(status.id)
    ActivityPub::DistributionWorker.perform_async(status.id) if status.local? && !status.local_only?

    return if !status.reply? || status.account.id == status.in_reply_to_account_id

    ActivityTracker.increment('activity:interactions')

    return if status.account.following?(status.in_reply_to_account_id)

    PotentialFriendshipTracker.record(status.account.id, status.in_reply_to_account_id, :reply)
  end
end