about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-05-04 04:45:08 +0200
committerGitHub <noreply@github.com>2021-05-04 04:45:08 +0200
commitfab65848d2eb8065ef3e49aaca4e4fb33f94f2b1 (patch)
tree1f6d597465d8f5e6e73aa7f3543339a36891eac3 /app/services
parent8c44b723bb7505eb5923019b454ce9abd7ea59c0 (diff)
Fix empty home feed before first follow has finished processing (#16152)
Change queue of merge worker from pull to default
Diffstat (limited to 'app/services')
-rw-r--r--app/services/follow_service.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index d3db07a74..329262cca 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -30,6 +30,11 @@ class FollowService < BaseService
 
     ActivityTracker.increment('activity:interactions')
 
+    # When an account follows someone for the first time, avoid showing
+    # an empty home feed while the follow request is being processed
+    # and the feeds are being merged
+    mark_home_feed_as_partial! if @source_account.not_following_anyone?
+
     if (@target_account.locked? && !@options[:bypass_locked]) || @source_account.silenced? || @target_account.activitypub?
       request_follow!
     elsif @target_account.local?
@@ -39,6 +44,10 @@ class FollowService < BaseService
 
   private
 
+  def mark_home_feed_as_partial!
+    redis.set("account:#{@source_account.id}:regeneration", true, nx: true, ex: 1.day.seconds)
+  end
+
   def following_not_possible?
     @target_account.nil? || @target_account.id == @source_account.id || @target_account.suspended?
   end