Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: gate completion CTA and localize flag copy

Blue Mouse91f31d480ea1
diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.ts
index 216d76e64..2757ace60 100644
--- a/backend/apps/cloud/src/analytics/analytics.service.ts
+++ b/backend/apps/cloud/src/analytics/analytics.service.ts
@@ -127,6 +127,8 @@ const isValidLocale = (lc: string): boolean => {
// 2 minutes
const LIVE_SESSION_THRESHOLD_SECONDS = 120
+const MAX_FILTERS = 100
+const MAX_FILTER_VALUES = 100
const SOFTWARE_WITH_PATCH_VERSION = ['GameVault']
@@ -1049,12 +1051,28 @@ export class AnalyticsService {
}
postProcessParsedFilters(parsedFilters: any[]): any[] {
+ if (!_isArray(parsedFilters)) {
+ throw new UnprocessableEntityException(
+ 'The provided filters are not in a valid format',
+ )
+ }
+
+ if (parsedFilters.length > MAX_FILTERS) {
+ throw new UnprocessableEntityException('Too many filters provided')
+ }
+
return _reduce(
parsedFilters,
(prev, curr) => {
const { column, filter, isExclusive, isContains = false } = curr
if (_isArray(filter)) {
+ if (filter.length > MAX_FILTER_VALUES) {
+ throw new UnprocessableEntityException(
+ 'Too many filter values provided',
+ )
+ }
+
const filterArray = _map(filter, (f) => ({
column,
filter: f,
@@ -1122,6 +1140,10 @@ export class AnalyticsService {
)
}
+ if (parsed.length > MAX_FILTERS) {
+ throw new UnprocessableEntityException('Too many filters provided')
+ }
+
const SUPPORTED_COLUMNS = this.getDataTypeColumns(dataType)
// Converting something like [{"column":"cc","filter":"BG", "isExclusive":false},{"column":"cc","filter":"PL", "isExclusive":false},{"column":"pg","filter":"/hello", "isExclusive":false}]
@@ -1162,6 +1184,12 @@ export class AnalyticsService {
// commented encodeURIComponent lines of code to support filtering for pages like /product/[id]
// until I find a more suitable solution for that later
if (_isArray(filter)) {
+ if (filter.length > MAX_FILTER_VALUES) {
+ throw new UnprocessableEntityException(
+ 'Too many filter values provided',
+ )
+ }
+
for (const f of filter) {
// let encoded = f
diff --git a/backend/apps/community/src/analytics/analytics.service.ts b/backend/apps/community/src/analytics/analytics.service.ts
index 7d6769872..982f8d294 100644
--- a/backend/apps/community/src/analytics/analytics.service.ts
+++ b/backend/apps/community/src/analytics/analytics.service.ts
@@ -119,6 +119,8 @@ const isValidLocale = (lc: string): boolean => {
// 2 minutes
const LIVE_SESSION_THRESHOLD_SECONDS = 120
+const MAX_FILTERS = 100
+const MAX_FILTER_VALUES = 100
const SOFTWARE_WITH_PATCH_VERSION = ['GameVault']
@@ -1067,12 +1069,28 @@ export class AnalyticsService {
}
postProcessParsedFilters(parsedFilters: any[]): any[] {
+ if (!_isArray(parsedFilters)) {
+ throw new UnprocessableEntityException(
+ 'The provided filters are not in a valid format',
+ )
+ }
+
+ if (parsedFilters.length > MAX_FILTERS) {
+ throw new UnprocessableEntityException('Too many filters provided')
+ }
+
return _reduce(
parsedFilters,
(prev, curr) => {
const { column, filter, isExclusive, isContains = false } = curr
if (_isArray(filter)) {
+ if (filter.length > MAX_FILTER_VALUES) {
+ throw new UnprocessableEntityException(
+ 'Too many filter values provided',
+ )
+ }
+
const filterArray = _map(filter, (f) => ({
column,
filter: f,
@@ -1140,6 +1158,10 @@ export class AnalyticsService {
)
}
+ if (parsed.length > MAX_FILTERS) {
+ throw new UnprocessableEntityException('Too many filters provided')
+ }
+
const SUPPORTED_COLUMNS = this.getDataTypeColumns(dataType)
// Converting something like [{"column":"cc","filter":"BG", "isExclusive":false},{"column":"cc","filter":"PL", "isExclusive":false},{"column":"pg","filter":"/hello", "isExclusive":false}]
@@ -1180,6 +1202,12 @@ export class AnalyticsService {
// commented encodeURIComponent lines of code to support filtering for pages like /product/[id]
// until I find a more suitable solution for that later
if (_isArray(filter)) {
+ if (filter.length > MAX_FILTER_VALUES) {
+ throw new UnprocessableEntityException(
+ 'Too many filter values provided',
+ )
+ }
+
for (const f of filter) {
// let encoded = f
diff --git a/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx b/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
index f9f3d9e5c..7022829b9 100644
--- a/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
+++ b/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
@@ -1104,6 +1104,8 @@ const ExperimentResults = ({
{t('experiments.complete')}
</Button>
)
+ const canCompleteExperiment =
+ results?.status === 'running' || results?.status === 'paused'
if (!experiment || !results) {
if (isLoading) {
@@ -1342,26 +1344,27 @@ const ExperimentResults = ({
</div>
{completeExperimentButton}
</div>
- ) : (
+ ) : canCompleteExperiment ? (
<div className='flex justify-end rounded-lg bg-gray-50 px-4 py-3 ring-1 ring-gray-200 dark:bg-slate-900/40 dark:ring-slate-800'>
{completeExperimentButton}
</div>
- )}
+ ) : null}
<div className='rounded-lg bg-gray-50 px-4 py-3 ring-1 ring-gray-200 dark:bg-slate-900/40 dark:ring-slate-800'>
<div className='flex flex-wrap items-center justify-between gap-3'>
<div>
<Text as='p' size='sm' weight='semibold'>
- Feature flag relationship
+ {t('experiments.resultDetails.featureFlagRelationship.title')}
</Text>
<Text as='p' size='xs' colour='muted'>
- The flag controls eligibility. Experiment exposures use actual
- evaluations and variant events.
+ {t(
+ 'experiments.resultDetails.featureFlagRelationship.description',
+ )}
</Text>
</div>
<Text as='span' size='xs' colour='secondary' code>
{experiment.featureFlagKey ||
experiment.featureFlagId ||
- 'created on launch'}
+ t('experiments.createdOnLaunch')}
</Text>
</div>
<div className='mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-4'>
diff --git a/web/public/locales/de.json b/web/public/locales/de.json
index 6e79c270c..9a376e61c 100644
--- a/web/public/locales/de.json
+++ b/web/public/locales/de.json
@@ -1573,6 +1573,10 @@
"finalSuffixNoOverlap": "da sich der ausgewählte Zeitraum nicht mit dem aktiven Experiment überschneidet.",
"clipped": "Zeigt den ausgewählten Zeitraum, zugeschnitten auf die aktive Experimentzeit, {{from}} bis {{to}}."
},
+ "featureFlagRelationship": {
+ "title": "Feature-Flag-Beziehung",
+ "description": "Das Flag steuert die Teilnahmeberechtigung. Experiment-Exposures verwenden tatsächliche Auswertungen und Varianten-Ereignisse."
+ },
"warnings": {
"noExposures": {
"title": "Keine Ausspielungen",
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index c968597c9..38c710d80 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -1573,6 +1573,10 @@
"finalSuffixNoOverlap": "because the selected period does not overlap the active experiment.",
"clipped": "Showing the selected period clipped to active experiment time, {{from}} to {{to}}."
},
+ "featureFlagRelationship": {
+ "title": "Feature flag relationship",
+ "description": "The flag controls eligibility. Experiment exposures use actual evaluations and variant events."
+ },
"warnings": {
"noExposures": {
"title": "No exposures",
diff --git a/web/public/locales/fr.json b/web/public/locales/fr.json
index 5c9ea6457..6c17e5778 100644
--- a/web/public/locales/fr.json
+++ b/web/public/locales/fr.json
@@ -1573,6 +1573,10 @@
"finalSuffixNoOverlap": "car la période sélectionnée ne chevauche pas l'expérience active.",
"clipped": "Affichage de la période sélectionnée restreinte à la durée de l'expérience active, de {{from}} à {{to}}."
},
+ "featureFlagRelationship": {
+ "title": "Relation du feature flag",
+ "description": "Le flag contrôle l'éligibilité. Les expositions à l'expérience utilisent les évaluations réelles et les événements de variante."
+ },
"warnings": {
"noExposures": {
"title": "Aucune exposition",
diff --git a/web/public/locales/pl.json b/web/public/locales/pl.json
index 9ac549715..569e68076 100644
--- a/web/public/locales/pl.json
+++ b/web/public/locales/pl.json
@@ -1573,6 +1573,10 @@
"finalSuffixNoOverlap": "ponieważ wybrany okres nie nakłada się z aktywnym eksperymentem.",
"clipped": "Wyświetlanie wybranego okresu ograniczonego do czasu trwania aktywnego eksperymentu, od {{from}} do {{to}}."
},
+ "featureFlagRelationship": {
+ "title": "Powiązanie flagi funkcji",
+ "description": "Flaga kontroluje kwalifikowalność. Ekspozycje eksperymentu wykorzystują rzeczywiste ewaluacje i zdarzenia wariantów."
+ },
"warnings": {
"noExposures": {
"title": "Brak ekspozycji",
diff --git a/web/public/locales/uk.json b/web/public/locales/uk.json
index c0472472e..7a5c1d896 100644
--- a/web/public/locales/uk.json
+++ b/web/public/locales/uk.json
@@ -1573,6 +1573,10 @@
"finalSuffixNoOverlap": "тому що вибраний період не перетинається з активним експериментом.",
"clipped": "Показано вибраний період, обмежений часом активного експерименту, з {{from}} до {{to}}."
},
+ "featureFlagRelationship": {
+ "title": "Зв'язок із feature flag",
+ "description": "Прапорець контролює допуск. Покази експерименту використовують фактичні оцінки та події варіантів."
+ },
"warnings": {
"noExposures": {
"title": "Немає показів",