Skip to content

Commit 1a4cd27

Browse files
committed
Fix /me
1 parent 2a2d448 commit 1a4cd27

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

src/Api/Controller/PlayerController.php

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,34 +115,16 @@ public function me(): JsonResponse
115115
throw new NotFoundHttpException('KILLER_USER_NOT_FOUND');
116116
}
117117

118-
// For backward compatibility, return the user's data along with their players
119-
// If the user has only one player, return that player's data
120-
$players = $user->getPlayers()->toArray();
121-
122-
// If there's exactly one player, return it with 'me' serialization for backward compatibility
123-
if (count($players) === 1) {
124-
$player = $players[0];
125-
$response = $this->json(
126-
$player,
127-
Response::HTTP_OK,
128-
[],
129-
[
130-
AbstractNormalizer::GROUPS => 'me',
131-
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
132-
],
133-
);
134-
} else {
135-
// Return user information with all their players
136-
$response = $this->json(
137-
$user,
138-
Response::HTTP_OK,
139-
[],
140-
[
141-
AbstractNormalizer::GROUPS => 'me',
142-
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
143-
],
144-
);
145-
}
118+
// Return user information with all their players
119+
$response = $this->json(
120+
$user,
121+
Response::HTTP_OK,
122+
[],
123+
[
124+
AbstractNormalizer::GROUPS => 'me',
125+
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
126+
],
127+
);
146128

147129
$response->headers->setCookie(CookieProvider::getJwtCookie(
148130
['mercure', ['subscribe' => ['*']]],

0 commit comments

Comments
 (0)