|
|
@ -272,8 +272,17 @@ class PublicApiController extends Controller
|
|
|
|
$min = $request->input('min_id');
|
|
|
|
$min = $request->input('min_id');
|
|
|
|
$max = $request->input('max_id');
|
|
|
|
$max = $request->input('max_id');
|
|
|
|
$limit = $request->input('limit') ?? 3;
|
|
|
|
$limit = $request->input('limit') ?? 3;
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$key = 'user:last_active_at:id:'.$user->id;
|
|
|
|
|
|
|
|
$ttl = now()->addMinutes(5);
|
|
|
|
|
|
|
|
Cache::remember($key, $ttl, function() use($user) {
|
|
|
|
|
|
|
|
$user->last_active_at = now();
|
|
|
|
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$filtered = UserFilter::whereUserId(Auth::user()->profile_id)
|
|
|
|
$filtered = UserFilter::whereUserId($user->profile_id)
|
|
|
|
->whereFilterableType('App\Profile')
|
|
|
|
->whereFilterableType('App\Profile')
|
|
|
|
->whereIn('filter_type', ['mute', 'block'])
|
|
|
|
->whereIn('filter_type', ['mute', 'block'])
|
|
|
|
->pluck('filterable_id')->toArray();
|
|
|
|
->pluck('filterable_id')->toArray();
|
|
|
@ -305,6 +314,7 @@ class PublicApiController extends Controller
|
|
|
|
->whereNotIn('profile_id', $filtered)
|
|
|
|
->whereNotIn('profile_id', $filtered)
|
|
|
|
->whereLocal(true)
|
|
|
|
->whereLocal(true)
|
|
|
|
->whereScope('public')
|
|
|
|
->whereScope('public')
|
|
|
|
|
|
|
|
->where('created_at', '>', now()->subDays(14))
|
|
|
|
->orderBy('created_at', 'desc')
|
|
|
|
->orderBy('created_at', 'desc')
|
|
|
|
->limit($limit)
|
|
|
|
->limit($limit)
|
|
|
|
->get();
|
|
|
|
->get();
|
|
|
@ -333,6 +343,7 @@ class PublicApiController extends Controller
|
|
|
|
->with('profile', 'hashtags', 'mentions')
|
|
|
|
->with('profile', 'hashtags', 'mentions')
|
|
|
|
->whereLocal(true)
|
|
|
|
->whereLocal(true)
|
|
|
|
->whereScope('public')
|
|
|
|
->whereScope('public')
|
|
|
|
|
|
|
|
->where('created_at', '>', now()->subDays(14))
|
|
|
|
->orderBy('created_at', 'desc')
|
|
|
|
->orderBy('created_at', 'desc')
|
|
|
|
->simplePaginate($limit);
|
|
|
|
->simplePaginate($limit);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -360,6 +371,15 @@ class PublicApiController extends Controller
|
|
|
|
$min = $request->input('min_id');
|
|
|
|
$min = $request->input('min_id');
|
|
|
|
$max = $request->input('max_id');
|
|
|
|
$max = $request->input('max_id');
|
|
|
|
$limit = $request->input('limit') ?? 3;
|
|
|
|
$limit = $request->input('limit') ?? 3;
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$key = 'user:last_active_at:id:'.$user->id;
|
|
|
|
|
|
|
|
$ttl = now()->addMinutes(5);
|
|
|
|
|
|
|
|
Cache::remember($key, $ttl, function() use($user) {
|
|
|
|
|
|
|
|
$user->last_active_at = now();
|
|
|
|
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Use redis for timelines
|
|
|
|
// TODO: Use redis for timelines
|
|
|
|
// $timeline = Timeline::build()->local();
|
|
|
|
// $timeline = Timeline::build()->local();
|
|
|
|