diff --git a/app/Http/Controllers/API/v1/EventController.php b/app/Http/Controllers/API/v1/EventController.php index 50404045b..0a982751b 100644 --- a/app/Http/Controllers/API/v1/EventController.php +++ b/app/Http/Controllers/API/v1/EventController.php @@ -271,20 +271,4 @@ public function suggest(Request $request): JsonResponse { } return $this->sendError(error: __('messages.exception.general'), code: 500); } - - /** - * @OA\Get( - * path="/activeEvents", - * operationId="getActiveEvents", - * tags={"Events"}, - * summary="DEPRECATED - USE /events - removed after 2024-08", - * description="DEPRECATED - USE /events - removed after 2024-08", - * @OA\Response(response=200, description="The events"), - * ) - * @return AnonymousResourceCollection - * @deprecated Use /events instead - removed after 2024-08 - */ - public function activeEvents(): AnonymousResourceCollection { - return EventResource::collection(Event::forTimestamp(now())->get()); - } } diff --git a/app/Http/Controllers/API/v1/FollowController.php b/app/Http/Controllers/API/v1/FollowController.php index 417f590e6..936f93f79 100644 --- a/app/Http/Controllers/API/v1/FollowController.php +++ b/app/Http/Controllers/API/v1/FollowController.php @@ -210,27 +210,6 @@ public function getFollowings(): AnonymousResourceCollection { return UserResource::collection(FollowBackend::getFollowings(user: auth()->user())); } - // TODO remove after 2024-10 - public function removeFollower(Request $request): JsonResponse { - $validated = $request->validate(['userId' => ['required',]]); - try { - $follow = Follow::where('user_id', $validated['userId']) - ->where('follow_id', auth()->user()->id) - ->firstOrFail(); - - $removeResponse = FollowBackend::removeFollower(follow: $follow, user: auth()->user()); - if ($removeResponse === true) { - return $this->sendResponse(); - } - Log::error('APIv1/removeFollower: Could not remove follower', ['follow' => $follow, 'user' => auth()->user()]); - return $this->sendError('Unknown error', 500); - } catch (ModelNotFoundException) { - return $this->sendError('Follow not found'); - } catch (AuthorizationException) { - return $this->sendError('Permission denied', 403); - } - } - /** * @param Request $request * @@ -327,21 +306,6 @@ public function approveFollowRequestByUserId(int $userId): JsonResponse { } } - // TODO remove after 2024-10 - public function approveFollowRequest(Request $request): JsonResponse { - $validated = $request->validate(['userId' => ['required',]]); - - try { - FollowBackend::approveFollower(auth()->user()->id, $validated['userId']); - return $this->sendResponse(); - } catch (ModelNotFoundException) { - return $this->sendError('Request not found'); - } catch (Exception) { - Log::error('APIv1/approveFollowRequest: Could not approve follow request', ['user' => auth()->user(), 'userId' => $validated['userId']]); - return $this->sendError('Unknown error', 500); - } - } - /** * @param Request $request * @@ -386,18 +350,4 @@ public function rejectFollowRequestByUserId(int $userId): JsonResponse { return $this->sendError('Unknown error', 500); } } - - // TODO remove after 2024-10 - public function rejectFollowRequest(Request $request): JsonResponse { - $validated = $request->validate(['userId' => ['required',]]); - try { - FollowBackend::rejectFollower(auth()->user()->id, $validated['userId']); - return $this->sendResponse(); - } catch (ModelNotFoundException) { - return $this->sendError('Request not found'); - } catch (Exception) { - Log::error('APIv1/rejectFollowRequest: Could not reject follow request', ['user' => auth()->user(), 'userId' => $validated['userId']]); - return $this->sendError('Unknown error', 500); - } - } } diff --git a/routes/api.php b/routes/api.php index b1931ebbe..7dfd078e4 100644 --- a/routes/api.php +++ b/routes/api.php @@ -112,11 +112,6 @@ Route::post('/{userId}/follow', [FollowController::class, 'createFollow']); Route::delete('/{userId}/follow', [FollowController::class, 'destroyFollow']); }); - Route::group(['middleware' => ['scope:write-followers']], static function() { - Route::delete('removeFollower', [FollowController::class, 'removeFollower']); // TODO remove after 2024-10 - Route::delete('rejectFollowRequest', [FollowController::class, 'rejectFollowRequest']); // TODO remove after 2024-10 - Route::put('approveFollowRequest', [FollowController::class, 'approveFollowRequest']); // TODO remove after 2024-10 - }); Route::group(['middleware' => ['scope:write-blocks']], static function() { Route::post('/{userId}/block', [UserController::class, 'createBlock']); Route::delete('/{userId}/block', [UserController::class, 'destroyBlock']); @@ -159,11 +154,6 @@ Route::delete('tokens', [TokenController::class, 'revokeAllTokens']); //TODO: undocumented endpoint - document when stable Route::delete('token', [TokenController::class, 'revokeToken']); //TODO: undocumented endpoint - document when stable }); - Route::group(['middleware' => ['scope:read-settings-followers']], static function() { - Route::get('followers', [FollowController::class, 'getFollowers']); // TODO remove after 2024-10 - Route::get('follow-requests', [FollowController::class, 'getFollowRequests']); // TODO remove after 2024-10 - Route::get('followings', [FollowController::class, 'getFollowings']); // TODO remove after 2024-10 - }); }); Route::group(['prefix' => 'webhooks'], static function() { Route::get('/', [WebhookController::class, 'getWebhooks']); @@ -216,7 +206,6 @@ Route::get('event/{slug}/details', [EventController::class, 'showDetails']); Route::get('event/{slug}/statuses', [EventController::class, 'statuses']); Route::get('events', [EventController::class, 'index']); - Route::get('activeEvents', [EventController::class, 'activeEvents']); //@deprecated: remove after 2024-08 Route::get('user/{username}', [UserController::class, 'show']); Route::get('user/{username}/statuses', [UserController::class, 'statuses']); }); diff --git a/tests/Feature/APIv1/FollowTest.php b/tests/Feature/APIv1/FollowTest.php index d2ec7d9e7..372bedaff 100644 --- a/tests/Feature/APIv1/FollowTest.php +++ b/tests/Feature/APIv1/FollowTest.php @@ -35,7 +35,7 @@ public function testCreateAndListFollow(): void { ]); //User 1 shouldn't have followers... - $response = $this->get('/api/v1/settings/followers'); + $response = $this->get('/api/v1/user/self/followers'); $response->assertOk(); $response->assertJsonStructure([ 'data', @@ -56,7 +56,7 @@ public function testCreateAndListFollow(): void { $this->assertCount(0, $response->json('data')); //...but user1 should have one following. - $response = $this->get('/api/v1/settings/followings'); + $response = $this->get('/api/v1/user/self/followings'); $response->assertOk(); $this->assertCount(1, $response->json('data')); }