diff --git a/api/modules/session/controllers/SessionController.php b/api/modules/session/controllers/SessionController.php index f120ba8..384d2f6 100644 --- a/api/modules/session/controllers/SessionController.php +++ b/api/modules/session/controllers/SessionController.php @@ -89,15 +89,12 @@ class SessionController extends ApiController { $hasJoinedForm = new HasJoinedForm($protocol); try { $hasJoinedForm->hasJoined(); + } catch (ForbiddenOperationException $e) { + return 'NO'; } catch (SessionServerException $e) { Yii::$app->response->statusCode = $e->statusCode; - if ($e instanceof ForbiddenOperationException) { - $message = 'NO'; - } else { - $message = $e->getMessage(); - } - return $message; + return $e->getMessage(); } return 'YES'; diff --git a/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php b/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php index b0133ac..8c2e07f 100644 --- a/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php +++ b/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php @@ -44,7 +44,7 @@ class HasJoinedLegacyCest { 'user' => 'random-username', 'serverId' => Uuid::uuid(), ]); - $I->seeResponseCodeIs(401); + $I->seeResponseCodeIs(200); $I->canSeeResponseEquals('NO'); }