Skip to content

Commit

Permalink
🔥 remove deprecated followings endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Jan 1, 2025
1 parent a86063f commit 8e479f7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
15 changes: 0 additions & 15 deletions app/Http/Controllers/API/v1/FollowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,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
*
Expand Down
3 changes: 0 additions & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +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::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']);
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/APIv1/FollowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'));
}
Expand Down

0 comments on commit 8e479f7

Please sign in to comment.