From 484c4d0c5dc347b79209f6870340df07d49bb5df Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 16 Feb 2020 02:18:37 -0600 Subject: do not try to process mentions in hidden posts --- app/services/process_mentions_service.rb | 2 +- app/workers/post_status_worker.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index bca00d575..ac39464fb 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -8,7 +8,7 @@ class ProcessMentionsService < BaseService # remote users # @param [Status] status def call(status, skip_process: false, skip_notify: false) - return unless status.local? && (!status.draft? || !status.hidden) + return if status.hidden || !status.local? || status.draft? @status = status mentions = Mention.where(status: status).to_a diff --git a/app/workers/post_status_worker.rb b/app/workers/post_status_worker.rb index f5ba1d3d2..68cae75fa 100644 --- a/app/workers/post_status_worker.rb +++ b/app/workers/post_status_worker.rb @@ -9,7 +9,8 @@ class PostStatusWorker status.update(options.slice(:visibility, :local_only, :reject_replies, :hidden).compact) status.reload - process_mentions_service.call(status, skip_process: options[:process_mentions] != true) unless options[:nomentions] + + process_mentions_service.call(status, skip_process: options[:process_mentions] != true) unless options[:nomentions] || status.hidden LinkCrawlWorker.perform_async(status.id) unless options[:nocrawl] || status.spoiler_text.present? DistributionWorker.perform_async(status.id) unless options[:distribute] == false @@ -20,7 +21,7 @@ class PostStatusWorker PollExpirationNotifyWorker.perform_at(status.poll.expires_at, status.poll.id) if status.poll - return true if !status.reply? || status.account.id == status.in_reply_to_account_id + return true if !status.reply? || status.account.id == status.in_reply_to_account_id || status.hidden 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) -- cgit