Merge pull request #3145 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-01-09 20:50:51 -07:00 committed by GitHub
commit a62d1a1e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 25 deletions

View file

@ -93,6 +93,8 @@
- Updated ApiV1Controller, fix public timeline endpoint. ([80c7def3](https://github.com/pixelfed/pixelfed/commit/80c7def3)) - Updated ApiV1Controller, fix public timeline endpoint. ([80c7def3](https://github.com/pixelfed/pixelfed/commit/80c7def3))
- Updated PublicApiController, fix public timeline endpoint. ([dcb7ba9c](https://github.com/pixelfed/pixelfed/commit/dcb7ba9c)) - Updated PublicApiController, fix public timeline endpoint. ([dcb7ba9c](https://github.com/pixelfed/pixelfed/commit/dcb7ba9c))
- Updated ApiV1Controller, fix home timeline entities. ([6fc0dcb3](https://github.com/pixelfed/pixelfed/commit/6fc0dcb3)) - Updated ApiV1Controller, fix home timeline entities. ([6fc0dcb3](https://github.com/pixelfed/pixelfed/commit/6fc0dcb3))
- Updated ApiV1Controller, fix favourites endpoints ([d6d99385](https://github.com/pixelfed/pixelfed/commit/d6d99385))
- Updated ApiV1Controller, fix reblogs endpoints ([de42d84c](https://github.com/pixelfed/pixelfed/commit/de42d84c))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)

View file

@ -136,21 +136,20 @@ class ApiV1Controller extends Controller
*/ */
public function verifyCredentials(Request $request) public function verifyCredentials(Request $request)
{ {
abort_if(!$request->user(), 403); $user = $request->user();
abort_if($request->user()->status != null, 403); abort_if(!$user, 403);
abort_if($user->status != null, 403);
$id = $request->user()->profile_id;
$res = AccountService::getMastodon($id); $res = AccountService::getMastodon($id);
// $res['source'] = [ $res['source'] = [
// 'privacy' => $res['locked'] ? 'private' : 'public', 'privacy' => $res['locked'] ? 'private' : 'public',
// 'sensitive' => false, 'sensitive' => false,
// 'language' => null, 'language' => $user->language ?? 'en',
// 'note' => '', 'note' => '',
// 'fields' => [] 'fields' => []
// ]; ];
return response()->json($res); return response()->json($res);
} }
@ -457,7 +456,7 @@ class ApiV1Controller extends Controller
*/ */
public function accountFollowingById(Request $request, $id) public function accountFollowingById(Request $request, $id)
{ {
abort_if(!$request->user(), 403); abort_if(!$request->user(), 403);
$account = AccountService::get($id); $account = AccountService::get($id);
abort_if(!$account, 404); abort_if(!$account, 404);
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
@ -504,7 +503,6 @@ class ApiV1Controller extends Controller
*/ */
public function accountStatusesById(Request $request, $id) public function accountStatusesById(Request $request, $id)
{ {
abort_if(!$request->user(), 403);
$user = $request->user(); $user = $request->user();
$this->validate($request, [ $this->validate($request, [
@ -1039,8 +1037,8 @@ class ApiV1Controller extends Controller
LikePipeline::dispatch($like); LikePipeline::dispatch($like);
} }
$resource = new Fractal\Resource\Item($status, new StatusTransformer()); $res = StatusService::getMastodon($status->id, false);
$res = $this->fractal->createData($resource)->toArray(); $res['favourited'] = true;
return response()->json($res); return response()->json($res);
} }
@ -1079,8 +1077,8 @@ class ApiV1Controller extends Controller
StatusService::del($status->id); StatusService::del($status->id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer()); $res = StatusService::getMastodon($status->id, false);
$res = $this->fractal->createData($resource)->toArray(); $res['favourited'] = false;
return response()->json($res); return response()->json($res);
} }
@ -2207,7 +2205,7 @@ class ApiV1Controller extends Controller
abort_if(!$request->user(), 403); abort_if(!$request->user(), 403);
$user = $request->user(); $user = $request->user();
$status = Status::findOrFail($id); $status = Status::whereScope('public')->findOrFail($id);
if($status->profile_id !== $user->profile_id) { if($status->profile_id !== $user->profile_id) {
if($status->scope == 'private') { if($status->scope == 'private') {
@ -2230,8 +2228,10 @@ class ApiV1Controller extends Controller
} }
StatusService::del($status->id); StatusService::del($status->id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray(); $res = StatusService::getMastodon($status->id);
$res['reblogged'] = true;
return response()->json($res); return response()->json($res);
} }
@ -2247,7 +2247,7 @@ class ApiV1Controller extends Controller
abort_if(!$request->user(), 403); abort_if(!$request->user(), 403);
$user = $request->user(); $user = $request->user();
$status = Status::findOrFail($id); $status = Status::whereScope('public')->findOrFail($id);
if($status->profile_id !== $user->profile_id) { if($status->profile_id !== $user->profile_id) {
if($status->scope == 'private') { if($status->scope == 'private') {
@ -2268,9 +2268,9 @@ class ApiV1Controller extends Controller
} }
UndoSharePipeline::dispatch($reblog); UndoSharePipeline::dispatch($reblog);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray(); $res = StatusService::getMastodon($status->id);
$res['reblogged'] = false; $res['reblogged'] = true;
return response()->json($res); return response()->json($res);
} }

View file

@ -231,7 +231,7 @@ class StatusController extends Controller
$user = Auth::user(); $user = Auth::user();
$profile = $user->profile; $profile = $user->profile;
$status = Status::whereIn('scope', ['public', 'unlisted']) $status = Status::whereScope('public')
->findOrFail($request->input('item')); ->findOrFail($request->input('item'));
$count = $status->reblogs_count; $count = $status->reblogs_count;