From 14423c5870035d6c881c363a0fae562c49533560 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 13 Sep 2023 11:48:22 +0200 Subject: [PATCH] feat: Limit exclude archived features (#4680) --- src/lib/db/project-store.ts | 2 +- src/lib/routes/admin-api/archive.ts | 2 +- src/lib/services/feature-toggle-service.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/db/project-store.ts b/src/lib/db/project-store.ts index 99ae90d0c5..7689409c5c 100644 --- a/src/lib/db/project-store.ts +++ b/src/lib/db/project-store.ts @@ -104,7 +104,7 @@ class ProjectStore implements IProjectStore { `SELECT EXISTS(SELECT 1 FROM project_settings LEFT JOIN features ON project_settings.project = features.project - WHERE project_settings.project = ? + WHERE project_settings.project = ? AND features.archived_at IS NULL GROUP BY project_settings.project HAVING project_settings.feature_limit <= COUNT(features.project)) AS present`, [id], diff --git a/src/lib/routes/admin-api/archive.ts b/src/lib/routes/admin-api/archive.ts index f0048d7ae5..a886a73ab6 100644 --- a/src/lib/routes/admin-api/archive.ts +++ b/src/lib/routes/admin-api/archive.ts @@ -170,7 +170,7 @@ export default class ArchiveController extends Controller { ): Promise { const userName = extractUsername(req); const { featureName } = req.params; - await this.featureService.reviveToggle(featureName, userName); + await this.featureService.reviveFeature(featureName, userName); res.status(200).end(); } } diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index 4f44af6f23..20c66aaf47 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -1823,7 +1823,7 @@ class FeatureToggleService { } // TODO: add project id. - async reviveToggle(featureName: string, createdBy: string): Promise { + async reviveFeature(featureName: string, createdBy: string): Promise { const toggle = await this.featureToggleStore.revive(featureName); const tags = await this.tagStore.getAllTagsForFeature(featureName); await this.eventStore.store(