diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index a374c57cf1..2801e45bb5 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -967,7 +967,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status') $dbForProject->deleteCachedDocument('users', $user->getId()); - $team = Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team->setAttribute('total', $team->getAttribute('total', 0) + 1))); + Authorization::skip(fn() => $dbForProject->increaseDocumentAttribute('teams', $team->getId(), 'total', 1)); $queueForEvents ->setParam('teamId', $team->getId()) @@ -1047,8 +1047,7 @@ App::delete('/v1/teams/:teamId/memberships/:membershipId') $dbForProject->deleteCachedDocument('users', $user->getId()); if ($membership->getAttribute('confirm')) { // Count only confirmed members - $team->setAttribute('total', \max($team->getAttribute('total', 0) - 1, 0)); - Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team)); + Authorization::skip(fn() => $dbForProject->decreaseDocumentAttribute('teams', $team->getId(), 'total', 1, 0)); } $queueForEvents diff --git a/composer.lock b/composer.lock index 4d5535b8f8..ca39c7d084 100644 --- a/composer.lock +++ b/composer.lock @@ -5124,5 +5124,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" }