mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update StatusTransformers
This commit is contained in:
parent
21f262315d
commit
a79d23d152
3 changed files with 9 additions and 5 deletions
|
@ -267,7 +267,7 @@ class ApiV1Controller extends Controller
|
|||
'max_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
|
||||
'since_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
|
||||
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
|
||||
'limit' => 'nullable|integer|min:1|max:40'
|
||||
'limit' => 'nullable|integer|min:1|max:80'
|
||||
]);
|
||||
|
||||
$profile = Profile::whereNull('status')->findOrFail($id);
|
||||
|
@ -748,6 +748,8 @@ class ApiV1Controller extends Controller
|
|||
]);
|
||||
|
||||
if($like->wasRecentlyCreated == true) {
|
||||
$status->likes_count = $status->likes()->count();
|
||||
$status->save();
|
||||
LikePipeline::dispatch($like);
|
||||
}
|
||||
|
||||
|
@ -777,6 +779,8 @@ class ApiV1Controller extends Controller
|
|||
|
||||
if($like) {
|
||||
$like->delete();
|
||||
$status->likes_count = $status->likes()->count();
|
||||
$status->save();
|
||||
}
|
||||
|
||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||
|
|
|
@ -28,8 +28,8 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'created_at' => $status->created_at->toJSON(),
|
||||
'emojis' => [],
|
||||
'replies_count' => 0,
|
||||
'reblogs_count' => $status->reblogs_count,
|
||||
'favourites_count' => $status->likes_count,
|
||||
'reblogs_count' => $status->reblogs_count ?? 0,
|
||||
'favourites_count' => $status->likes_count ?? 0,
|
||||
'reblogged' => null,
|
||||
'favourited' => null,
|
||||
'muted' => null,
|
||||
|
|
|
@ -25,8 +25,8 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'content' => $status->rendered ?? $status->caption,
|
||||
'created_at' => $status->created_at->format('c'),
|
||||
'emojis' => [],
|
||||
'reblogs_count' => $status->reblogs_count,
|
||||
'favourites_count' => $status->likes_count,
|
||||
'reblogs_count' => $status->reblogs_count ?? 0,
|
||||
'favourites_count' => $status->likes_count ?? 0,
|
||||
'reblogged' => $status->shared(),
|
||||
'favourited' => $status->liked(),
|
||||
'muted' => null,
|
||||
|
|
Loading…
Reference in a new issue