diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php index 6564f17b8..924dba6d7 100644 --- a/app/Http/Controllers/TimelineController.php +++ b/app/Http/Controllers/TimelineController.php @@ -3,7 +3,8 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use App\{Status, User}; +use Auth; +use App\{Follower, Status, User}; class TimelineController extends Controller { @@ -14,7 +15,17 @@ class TimelineController extends Controller public function personal() { - $timeline = Status::orderBy('id','desc')->paginate(10); + // TODO: Use redis for timelines + $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id'); + $timeline = Status::whereHas('media')->whereNull('in_reply_to_id')->whereIn('profile_id', $following)->orderBy('id','desc')->simplePaginate(10); return view('timeline.personal', compact('timeline')); } + + public function local() + { + // TODO: Use redis for timelines + $timeline = Status::whereHas('media')->whereNull('in_reply_to_id')->orderBy('id','desc')->simplePaginate(10); + return view('timeline.public', compact('timeline')); + } + }