1
0
Fork 0
forked from mirror/pixelfed

Add local timeline to TimelineController

This commit is contained in:
Daniel Supernault 2018-05-31 16:05:39 -06:00
parent dde1e19d55
commit a7b186d7fb

View file

@ -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'));
}
}