From 8cc5efa2cb6ec26710b8bbd063951857828bb13a Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Sep 2025 15:06:38 +0300 Subject: [PATCH] Use Document --- app/controllers/api/teams.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 7b297fb17b..c15d91a3bb 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -365,7 +365,7 @@ App::put('/v1/teams/:teamId/prefs') ->inject('queueForEvents') ->action(function (string $teamId, array $prefs, Response $response, Database $dbForProject, Event $queueForEvents) { try { - $prefsDocument = new Document($prefs); + $prefs = new Document($prefs); } catch (StructureException $e) { throw new Exception(Exception::DOCUMENT_INVALID_STRUCTURE, $e->getMessage()); } @@ -376,11 +376,12 @@ App::put('/v1/teams/:teamId/prefs') throw new Exception(Exception::TEAM_NOT_FOUND); } - $team = $dbForProject->updateDocument('teams', $team->getId(), $team->setAttribute('prefs', $prefs)); + $team->setAttribute('prefs', $prefs->getArrayCopy()); + $team = $dbForProject->updateDocument('teams', $team->getId(), $team); $queueForEvents->setParam('teamId', $team->getId()); - $response->dynamic($prefsDocument, Response::MODEL_PREFERENCES); + $response->dynamic($prefs, Response::MODEL_PREFERENCES); }); App::delete('/v1/teams/:teamId')