Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(insights): remove unused reportCohortCreatedFromPersonsModal #23085

Merged
Merged
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportPersonsModalViewed: (params: any) => ({
params,
}),
reportCohortCreatedFromPersonsModal: (filters: Partial<FilterType>) => ({ filters }),
// insights
reportInsightCreated: (insightType: InsightType | null) => ({ insightType }),
reportInsightSaved: (filters: Partial<FilterType>, isNewInsight: boolean) => ({ filters, isNewInsight }),
Expand Down Expand Up @@ -642,9 +641,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportPersonsModalViewed: async ({ params }) => {
posthog.capture('insight person modal viewed', params)
},
reportCohortCreatedFromPersonsModal: async ({ filters }) => {
posthog.capture('person modal cohort created', sanitizeFilterParams(filters))
},
reportDashboardViewed: async ({ dashboard, lastRefreshed, delay }, breakpoint) => {
if (!delay) {
await breakpoint(500) // Debounce to avoid noisy events from continuous navigation
Expand Down
41 changes: 12 additions & 29 deletions frontend/src/scenes/trends/persons-modal/personsModalLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { actions, afterMount, connect, kea, listeners, path, props, propsChanged
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import api from 'lib/api'
import { fromParamsGivenUrl, isGroupType } from 'lib/utils'
import { isGroupType } from 'lib/utils'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { cleanFilters } from 'scenes/insights/utils/cleanFilters'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -75,7 +75,7 @@ export const personsModalLogic = kea<personsModalLogicType>([
}),
connect({
values: [groupsModel, ['groupTypes', 'aggregationLabel']],
actions: [eventUsageLogic, ['reportCohortCreatedFromPersonsModal', 'reportPersonsModalViewed']],
actions: [eventUsageLogic, ['reportPersonsModalViewed']],
}),

loaders(({ values, actions, props }) => ({
Expand Down Expand Up @@ -250,33 +250,16 @@ export const personsModalLogic = kea<personsModalLogicType>([
is_static: true,
name: cohortName,
}
if (values.actorsQuery) {
const cohort = await api.create('api/cohort', { ...cohortParams, query: values.actorsQuery })
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})
actions.setIsCohortModalOpen(false)
} else {
const qs = props.url?.split('?').pop() || ''
const cohort = await api.create('api/cohort?' + qs, cohortParams)
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})

const filters = fromParamsGivenUrl('?' + qs)
actions.setIsCohortModalOpen(false)
actions.reportCohortCreatedFromPersonsModal(filters)
}
const cohort = await api.create('api/cohort', { ...cohortParams, query: values.actorsQuery })
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})
actions.setIsCohortModalOpen(false)
},
loadNextActors: () => {
if (values.actorsResponse?.next) {
Expand Down
Loading