From 484208ce12402d8b82070038d9be8441b82f86e7 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Tue, 17 Oct 2017 20:05:21 +0200
Subject: [PATCH] When status is fetched instead of delivered, do not stream it
 (#5437)

---
 app/lib/activitypub/activity.rb      | 7 ++++++-
 app/lib/ostatus/activity/creation.rb | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index 9688f57a64..01144f5952 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -67,9 +67,14 @@ class ActivityPub::Activity
   end
 
   def distribute(status)
+    crawl_links(status)
+
+    # Only continue if the status is supposed to have
+    # arrived in real-time
+    return unless @options[:override_timestamps]
+
     notify_about_reblog(status) if reblog_of_local_account?(status)
     notify_about_mentions(status)
-    crawl_links(status)
     distribute_to_followers(status)
   end
 
diff --git a/app/lib/ostatus/activity/creation.rb b/app/lib/ostatus/activity/creation.rb
index a1ab522e23..3418e24205 100644
--- a/app/lib/ostatus/activity/creation.rb
+++ b/app/lib/ostatus/activity/creation.rb
@@ -56,7 +56,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
     Rails.logger.debug "Queuing remote status #{status.id} (#{id}) for distribution"
 
     LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
-    DistributionWorker.perform_async(status.id)
+    DistributionWorker.perform_async(status.id) if @options[:override_timestamps]
 
     status
   end
-- 
GitLab