From 3366a957219b15f5ab6f6eabbf5466e1e12082de Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Mon, 20 Jul 2020 03:58:14 -0500 Subject: [Feature] Add command tags; add #!edit and #!publish commands for mobile users --- app/services/publish_status_service.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/services/publish_status_service.rb (limited to 'app/services/publish_status_service.rb') diff --git a/app/services/publish_status_service.rb b/app/services/publish_status_service.rb new file mode 100644 index 000000000..737186a17 --- /dev/null +++ b/app/services/publish_status_service.rb @@ -0,0 +1,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 -- cgit