about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2020-08-31 12:28:25 -0500
committerStarfall <us@starfall.systems>2020-08-31 12:28:25 -0500
commitc5bb91194f0df90ea9c59ea6af1bd985b295fb30 (patch)
tree47b303b2c64ff1920fb19d01093a08dc9fd20ac8 /app/services
parent27ee0fc8c4c13c53f81ca3db781b9d0783b877e5 (diff)
parentf715e8b51612820a18fa307e4465eb0c1a088f86 (diff)
Merge branch 'glitch' into main
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fan_out_on_write_service.rb10
-rw-r--r--app/services/hashtag_query_service.rb2
2 files changed, 7 insertions, 5 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index dd9c1264d..5f3feeed9 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -8,8 +8,6 @@ class FanOutOnWriteService < BaseService
 
     deliver_to_self(status) if status.account.local?
 
-    render_anonymous_payload(status)
-
     if status.direct_visibility?
       deliver_to_mentioned_followers(status)
       deliver_to_direct_timelines(status)
@@ -24,6 +22,8 @@ class FanOutOnWriteService < BaseService
     return if status.account.silenced? || !status.public_visibility?
     return if status.reblog? && !Setting.show_reblogs_in_public_timelines
 
+    render_anonymous_payload(status)
+
     deliver_to_hashtags(status)
 
     return if status.reply? && status.in_reply_to_account_id != status.account_id && !Setting.show_replies_in_public_timelines
@@ -63,8 +63,10 @@ class FanOutOnWriteService < BaseService
   def deliver_to_mentioned_followers(status)
     Rails.logger.debug "Delivering status #{status.id} to limited followers"
 
-    FeedInsertWorker.push_bulk(status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? && mentioned_account.following?(status.account) }) do |follower|
-      [status.id, follower.id, :home]
+    status.mentions.joins(:account).merge(status.account.followers_for_local_distribution).select(:id).reorder(nil).find_in_batches do |followers|
+      FeedInsertWorker.push_bulk(followers) do |follower|
+        [status.id, follower.id, :home]
+      end
     end
   end
 
diff --git a/app/services/hashtag_query_service.rb b/app/services/hashtag_query_service.rb
index 196de0639..0bdf60221 100644
--- a/app/services/hashtag_query_service.rb
+++ b/app/services/hashtag_query_service.rb
@@ -8,7 +8,7 @@ class HashtagQueryService < BaseService
     all  = tags_for(params[:all])
     none = tags_for(params[:none])
 
-    Status.distinct
+    Status.group(:id)
           .as_tag_timeline(tags, account, local)
           .tagged_with_all(all)
           .tagged_with_none(none)