Self-hosters shouldn't be stuck with a hardcoded 100-project limit; MAX_PROJECTS_PER_OWNER now controls it, defaulting to 0 (unlimited). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit was merged in pull request #2.
This commit is contained in:
@@ -18,11 +18,12 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
final class ProjectController extends ProjectScopedController
|
||||
{
|
||||
private const TITLE_MAX = 255;
|
||||
private const MAX_PROJECTS_PER_OWNER = 100;
|
||||
|
||||
public function __construct(
|
||||
ProjectRepository $projects,
|
||||
private readonly CardStatusRepository $statuses,
|
||||
/** Maximum number of projects a single owner may create. 0 means unlimited. */
|
||||
private readonly int $maxProjectsPerOwner,
|
||||
) {
|
||||
parent::__construct($projects);
|
||||
}
|
||||
@@ -48,9 +49,9 @@ final class ProjectController extends ProjectScopedController
|
||||
$title = $validator->requiredString('title', self::TITLE_MAX);
|
||||
$validator->assert();
|
||||
|
||||
if ($this->projects->countForOwner($ownerId) >= self::MAX_PROJECTS_PER_OWNER) {
|
||||
if ($this->maxProjectsPerOwner > 0 && $this->projects->countForOwner($ownerId) >= $this->maxProjectsPerOwner) {
|
||||
throw new ApiException(
|
||||
sprintf('You have reached the maximum of %d projects.', self::MAX_PROJECTS_PER_OWNER),
|
||||
sprintf('You have reached the maximum of %d projects.', $this->maxProjectsPerOwner),
|
||||
409,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user