Apply fixes from StyleCI
This commit is contained in:
parent
75de27f482
commit
b8abbdd90f
261 changed files with 3368 additions and 3231 deletions
|
@ -2,57 +2,61 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Follower;
|
||||
use App\Profile;
|
||||
use App\Status;
|
||||
use App\User;
|
||||
use App\UserFilter;
|
||||
use Auth;
|
||||
use App\{Follower, Profile, Status, User, UserFilter};
|
||||
|
||||
class TimelineController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function personal()
|
||||
{
|
||||
$pid = Auth::user()->profile->id;
|
||||
// TODO: Use redis for timelines
|
||||
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
||||
$following->push($pid);
|
||||
$filtered = UserFilter::whereUserId($pid)
|
||||
$pid = Auth::user()->profile->id;
|
||||
// TODO: Use redis for timelines
|
||||
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
||||
$following->push($pid);
|
||||
$filtered = UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id');
|
||||
$timeline = Status::whereIn('profile_id', $following)
|
||||
$timeline = Status::whereIn('profile_id', $following)
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->orderBy('id','desc')
|
||||
->orderBy('id', 'desc')
|
||||
->withCount(['comments', 'likes'])
|
||||
->simplePaginate(20);
|
||||
$type = 'personal';
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
$type = 'personal';
|
||||
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
}
|
||||
|
||||
public function local()
|
||||
{
|
||||
// TODO: Use redis for timelines
|
||||
// $timeline = Timeline::build()->local();
|
||||
$pid = Auth::user()->profile->id;
|
||||
// TODO: Use redis for timelines
|
||||
// $timeline = Timeline::build()->local();
|
||||
$pid = Auth::user()->profile->id;
|
||||
|
||||
$filtered = UserFilter::whereUserId($pid)
|
||||
$filtered = UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id');
|
||||
$private = Profile::whereIsPrivate(true)->pluck('id');
|
||||
$filtered = $filtered->merge($private);
|
||||
$timeline = Status::whereHas('media')
|
||||
$private = Profile::whereIsPrivate(true)->pluck('id');
|
||||
$filtered = $filtered->merge($private);
|
||||
$timeline = Status::whereHas('media')
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->withCount(['comments', 'likes'])
|
||||
->orderBy('id','desc')
|
||||
->orderBy('id', 'desc')
|
||||
->simplePaginate(20);
|
||||
$type = 'local';
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
}
|
||||
$type = 'local';
|
||||
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue