about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-24 18:01:00 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-24 18:01:00 -0500
commit88c23ae91292815cd47583b6a841fac6489fb9df (patch)
tree71943cbdb46900721e1100f60be6959874fcbfa7 /app
parent9cd09d4a70a8cd6693f80b86b3933aa94d72402a (diff)
logger should not generate link cards or mentions for entries
Diffstat (limited to 'app')
-rw-r--r--app/services/post_status_service.rb6
-rw-r--r--app/workers/log_worker.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index c26f76a1b..b24ca02b3 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -30,6 +30,8 @@ class PostStatusService < BaseService
   # @option [String] :language
   # @option [String] :scheduled_at
   # @option [String] :delete_after
+  # @option [Boolean] :nocrawl Optional skip link card generation
+  # @option [Boolean] :nomentions Optional skip mention processing
   # @option [Hash] :poll Optional poll to attach
   # @option [Enumerable] :media_ids Optional array of media IDs to attach
   # @option [Doorkeeper::Application] :application
@@ -147,7 +149,7 @@ class PostStatusService < BaseService
     return false if @status.destroyed?
 
     process_hashtags_service.call(@status, @tags, @preloaded_tags)
-    process_mentions_service.call(@status)
+    process_mentions_service.call(@status) unless @options[:nomentions]
 
     return true
   end
@@ -170,7 +172,7 @@ class PostStatusService < BaseService
   end
 
   def postprocess_status!
-    LinkCrawlWorker.perform_async(@status.id) unless @status.spoiler_text?
+    LinkCrawlWorker.perform_async(@status.id) unless @options[:nocrawl] || @status.spoiler_text?
     DistributionWorker.perform_async(@status.id) unless @options[:distribute] == false
 
     unless @status.local_only? || @options[:distribute] == false || @options[:federate] == false
diff --git a/app/workers/log_worker.rb b/app/workers/log_worker.rb
index 556820e16..abeadefa6 100644
--- a/app/workers/log_worker.rb
+++ b/app/workers/log_worker.rb
@@ -21,6 +21,8 @@ class LogWorker
       local_only: true,
       content_type: 'text/plain',
       language: 'en',
+      nocrawl: true,
+      nomentions: true,
     )
   rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
     true