From 6c4c84b161947cb11ad0451a39e26b25be4c93d5 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 8 Mar 2016 20:16:11 +0100 Subject: Distrubute statuses as a fan-out-on-write system, with optional precomputing --- app/controllers/api/statuses_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/controllers/api') diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb index 82334a32f..04128537a 100644 --- a/app/controllers/api/statuses_controller.rb +++ b/app/controllers/api/statuses_controller.rb @@ -22,10 +22,12 @@ class Api::StatusesController < ApiController end def home - @statuses = Status.where(account: [current_user.account] + current_user.account.following).order('created_at desc') + feed = Feed.new(:home, current_user.account) + @statuses = feed.get(20, (params[:offset] || 0).to_i) end def mentions - @statuses = Status.where(id: Mention.where(account: current_user.account).pluck(:status_id)).order('created_at desc') + feed = Feed.new(:mentions, current_user.account) + @statuses = feed.get(20, (params[:offset] || 0).to_i) end end -- cgit