mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-21 15:22:42 +00:00
Update ApiV1Controller.php
This commit is contained in:
parent
1f30beccf3
commit
8ed8305f5d
1 changed files with 9 additions and 1 deletions
|
@ -1426,6 +1426,8 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$status['favourited'] = true;
|
||||
$status['favourites_count'] = $status['favourites_count'] + 1;
|
||||
$status['bookmarked'] = BookmarkService::get($user->profile_id, $status['id']);
|
||||
$status['reblogged'] = ReblogService::get($user->profile_id, $status['id']);
|
||||
|
||||
return $this->json($status);
|
||||
}
|
||||
|
@ -1484,6 +1486,8 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$status['favourited'] = false;
|
||||
$status['favourites_count'] = isset($ogStatus) ? $ogStatus->likes_count : $status['favourites_count'] - 1;
|
||||
$status['bookmarked'] = BookmarkService::get($user->profile_id, $status['id']);
|
||||
$status['reblogged'] = ReblogService::get($user->profile_id, $status['id']);
|
||||
|
||||
return $this->json($status);
|
||||
}
|
||||
|
@ -3490,7 +3494,7 @@ class ApiV1Controller extends Controller
|
|||
return [];
|
||||
}
|
||||
|
||||
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : null;
|
||||
$content = $request->filled('status') ? strip_tags($request->input('status')) : null;
|
||||
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
|
||||
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
|
||||
|
||||
|
@ -3695,6 +3699,8 @@ class ApiV1Controller extends Controller
|
|||
ReblogService::add($user->profile_id, $status->id);
|
||||
$res = StatusService::getMastodon($status->id);
|
||||
$res['reblogged'] = true;
|
||||
$res['favourited'] = LikeService::liked($user->profile_id, $status->id);
|
||||
$res['bookmarked'] = BookmarkService::get($user->profile_id, $status->id);
|
||||
|
||||
return $this->json($res);
|
||||
}
|
||||
|
@ -3741,6 +3747,8 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$res = StatusService::getMastodon($status->id);
|
||||
$res['reblogged'] = false;
|
||||
$res['favourited'] = LikeService::liked($user->profile_id, $status->id);
|
||||
$res['bookmarked'] = BookmarkService::get($user->profile_id, $status->id);
|
||||
|
||||
return $this->json($res);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue