Skip to content

Commit 00c9b6f

Browse files
committed
has_not_done for goals is now named is not in the UI
1 parent 3b56a0e commit 00c9b6f

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

assets/js/dashboard/components/filter-operator-selector.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export default function FilterOperatorSelector(props) {
7676
FILTER_OPERATIONS.isNot,
7777
supportsIsNot(filterName)
7878
)}
79+
{renderTypeItem(
80+
FILTER_OPERATIONS.has_not_done,
81+
supportsHasDoneNot(filterName)
82+
)}
7983
{renderTypeItem(
8084
FILTER_OPERATIONS.contains,
8185
supportsContains(filterName)
@@ -84,10 +88,6 @@ export default function FilterOperatorSelector(props) {
8488
FILTER_OPERATIONS.contains_not,
8589
supportsContains(filterName) && supportsIsNot(filterName)
8690
)}
87-
{renderTypeItem(
88-
FILTER_OPERATIONS.has_not_done,
89-
supportsHasDoneNot(filterName)
90-
)}
9191
</div>
9292
</Menu.Items>
9393
</Transition>

assets/js/dashboard/util/filter-text.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('styledFilterText() and plainFilterText()', () => {
99
[['is', 'country', ['US']], { US: 'United States' }, 'Country is United States'],
1010
[['is', 'goal', ['Signup']], {}, 'Goal is Signup'],
1111
[['is', 'props:browser_language', ['en-US']], {}, 'Property browser_language is en-US'],
12-
[['has_not_done', 'goal', ['Signup', 'Login']], {}, 'Has not done goal Signup or Login'],
12+
[['has_not_done', 'goal', ['Signup', 'Login']], {}, 'Goal is not Signup or Login'],
1313
])(
1414
'when filter is %p and labels are %p, functions return %p',
1515
(filter, labels, expectedPlainText) => {

assets/js/dashboard/util/filter-text.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, { ReactNode, isValidElement, Fragment } from 'react'
44
import { DashboardQuery, Filter } from '../query'
55
import {
66
EVENT_PROPS_PREFIX,
7-
FILTER_OPERATIONS,
87
FILTER_OPERATIONS_DISPLAY_NAMES,
98
formattedFilters,
109
getLabel,
@@ -36,24 +35,13 @@ export function styledFilterText(
3635
throw new Error(`Unknown filter: ${filterKey}`)
3736
}
3837

39-
if (operation === FILTER_OPERATIONS.has_not_done) {
40-
// Has not done goal Visit foo
41-
return (
42-
<>
43-
{capitalize(FILTER_OPERATIONS_DISPLAY_NAMES[operation])}{' '}
44-
{formattedFilter.toLowerCase()} {formatClauses(clausesLabels)}
45-
</>
46-
)
47-
} else {
48-
// Hostname is example.com
49-
return (
50-
<>
51-
{capitalize(formattedFilter)}{' '}
52-
{FILTER_OPERATIONS_DISPLAY_NAMES[operation]}{' '}
53-
{formatClauses(clausesLabels)}
54-
</>
55-
)
56-
}
38+
return (
39+
<>
40+
{capitalize(formattedFilter)}{' '}
41+
{FILTER_OPERATIONS_DISPLAY_NAMES[operation]}{' '}
42+
{formatClauses(clausesLabels)}
43+
</>
44+
)
5745
}
5846

5947
export function plainFilterText(query: DashboardQuery, filter: Filter) {

assets/js/dashboard/util/filters.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export const FILTER_OPERATIONS_DISPLAY_NAMES = {
3939
[FILTER_OPERATIONS.isNot]: 'is not',
4040
[FILTER_OPERATIONS.contains]: 'contains',
4141
[FILTER_OPERATIONS.contains_not]: 'does not contain',
42-
[FILTER_OPERATIONS.has_not_done]: 'has not done'
42+
// :NOTE: Goal filters are displayed as "is not" in the UI, but in the backend they are wrapped with has_not_done.
43+
// It is currently unclear if we'll do the same for other event filters in the future.
44+
[FILTER_OPERATIONS.has_not_done]: 'is not'
4345
}
4446

4547
const OPERATION_PREFIX = {

0 commit comments

Comments
 (0)