about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-02-08 23:09:47 +0000
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:21 -0500
commita7aa2544e4f5926414af75e5c0acaa06c2ec7873 (patch)
treeeadfe45f2d2abb8b7beda16ad47baaddc7e56ae4 /app/services
parent9a94d5e2c5c2a3a48ef2a91c07be873e95245afc (diff)
community world tl + networked home tl
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fan_out_on_write_service.rb33
-rw-r--r--app/services/process_hashtags_service.rb4
2 files changed, 26 insertions, 11 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index b66dc342e..2065acde3 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -21,15 +21,29 @@ class FanOutOnWriteService < BaseService
       deliver_to_lists(status)
     end
 
-    return if status.account.silenced? || !status.public_visibility?
     return if status.reblog? && !Setting.show_reblogs_in_public_timelines
+    return if status.account.silenced?
+
+    deliver_to_hashtags(status) if !status.reblog? && status.distributable?
 
-    deliver_to_hashtags(status)
+    # we want to let community users decide what goes on the ftl with boosts
+    return unless status.network? || status.relayed?
+    deliver_to_local = true
+
+    if status.reblog? then
+      status = Status.find(status.reblog_of_id)
+      render_anonymous_payload(status)
+      deliver_to_local = status.network?
+    end
 
+    return if status.account.silenced? || !status.public_visibility?
     return if status.reply? && status.in_reply_to_account_id != status.account_id && !Setting.show_replies_in_public_timelines
 
-    deliver_to_public(status)
-    deliver_to_media(status) if status.media_attachments.any?
+    if deliver_to_local then
+      deliver_to_local(status)
+    else
+      deliver_to_public(status)
+    end
   end
 
   private
@@ -85,14 +99,15 @@ class FanOutOnWriteService < BaseService
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
 
     Redis.current.publish('timeline:public', @payload)
-    Redis.current.publish('timeline:public:local', @payload) if status.local?
+    Redis.current.publish('timeline:public:media', @payload) if status.media_attachments.any?
   end
 
-  def deliver_to_media(status)
-    Rails.logger.debug "Delivering status #{status.id} to media timeline"
+  def deliver_to_local(status)
+    Rails.logger.debug "Delivering status #{status.id} to local timeline"
 
-    Redis.current.publish('timeline:public:media', @payload)
-    Redis.current.publish('timeline:public:local:media', @payload) if status.local?
+    return unless status.network?
+    Redis.current.publish('timeline:public:local', @payload)
+    Redis.current.publish('timeline:public:local:media', @payload) if status.media_attachments.any?
   end
 
   def deliver_to_direct_timelines(status)
diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb
index d5ec076a8..fb89f6c5b 100644
--- a/app/services/process_hashtags_service.rb
+++ b/app/services/process_hashtags_service.rb
@@ -2,7 +2,7 @@
 
 class ProcessHashtagsService < BaseService
   def call(status, tags = [])
-    tags    = Extractor.extract_hashtags(status.text) if status.local?
+    tags    = Extractor.extract_hashtags(status.text) if status.network?
     records = []
 
     tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |name|
@@ -11,7 +11,7 @@ class ProcessHashtagsService < BaseService
       status.tags << tag
       records << tag
 
-      TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility?
+      TrendingTags.record_use!(tag, status.account, status.created_at) if status.distributable?
     end
 
     return unless status.public_visibility? || status.unlisted_visibility?