about summary refs log tree commit diff
path: root/app/controllers/api/v1/timelines/home_controller.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-18 22:00:11 -0600
committerGitHub <noreply@github.com>2018-01-18 22:00:11 -0600
commit26ecee79bfd4cb4f97a91e57e7a8b3fb7de3d82a (patch)
tree08e5da13297f842a0416898307685bdd020865b6 /app/controllers/api/v1/timelines/home_controller.rb
parentae369bceb35a4d9ee964fecb19d4c0ab83a05080 (diff)
parent3896cd5d79d8b46473b935b00caf31ef943fb21d (diff)
Merge pull request #332 from glitch-soc/merge-upstream
Merge in home feed regeneration changes from upstream
Diffstat (limited to 'app/controllers/api/v1/timelines/home_controller.rb')
-rw-r--r--app/controllers/api/v1/timelines/home_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/api/v1/timelines/home_controller.rb b/app/controllers/api/v1/timelines/home_controller.rb
index db6cd8568..bbbcf7f90 100644
--- a/app/controllers/api/v1/timelines/home_controller.rb
+++ b/app/controllers/api/v1/timelines/home_controller.rb
@@ -9,7 +9,11 @@ class Api::V1::Timelines::HomeController < Api::BaseController
 
   def show
     @statuses = load_statuses
-    render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
+
+    render json: @statuses,
+           each_serializer: REST::StatusSerializer,
+           relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id),
+           status: regeneration_in_progress? ? 206 : 200
   end
 
   private
@@ -57,4 +61,8 @@ class Api::V1::Timelines::HomeController < Api::BaseController
   def pagination_since_id
     @statuses.first.id
   end
+
+  def regeneration_in_progress?
+    Redis.current.exists("account:#{current_account.id}:regeneration")
+  end
 end