mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update StatusHashtagService, use StatusService for statuses
This commit is contained in:
parent
6e44ae0b64
commit
0355b567dd
1 changed files with 5 additions and 11 deletions
|
@ -16,6 +16,10 @@ class StatusHashtagService {
|
|||
|
||||
public static function get($id, $page = 1, $stop = 9)
|
||||
{
|
||||
if($page > 20) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return StatusHashtag::whereHashtagId($id)
|
||||
->whereStatusVisibility('public')
|
||||
->whereHas('media')
|
||||
|
@ -66,16 +70,6 @@ class StatusHashtagService {
|
|||
|
||||
public static function getStatus($statusId, $hashtagId)
|
||||
{
|
||||
return Cache::remember('pf:services:status-hashtag:post:'.$statusId.':hashtag:'.$hashtagId, now()->addMonths(3), function() use($statusId, $hashtagId) {
|
||||
$statusHashtag = StatusHashtag::with('profile', 'status', 'hashtag')
|
||||
->whereStatusVisibility('public')
|
||||
->whereStatusId($statusId)
|
||||
->whereHashtagId($hashtagId)
|
||||
->first();
|
||||
$fractal = new Fractal\Manager();
|
||||
$fractal->setSerializer(new ArraySerializer());
|
||||
$resource = new Fractal\Resource\Item($statusHashtag, new StatusHashtagTransformer());
|
||||
return $fractal->createData($resource)->toArray();
|
||||
});
|
||||
return ['status' => StatusService::get($statusId)];
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue