diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema.ts index fae45851247..f4d79131d9b 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema.ts @@ -2558,14 +2558,14 @@ export interface CustomChannelCondition { key: CustomChannelField value?: string | string[] op: CustomChannelOperator - id: string + id: string // the ID is only needed for the drag and drop, so only needs to be unique with one set of rules } export interface CustomChannelRule { items: CustomChannelCondition[] combiner: FilterLogicalOperator channel_type: string - id: string + id: string // the ID is only needed for the drag and drop, so only needs to be unique with one set of rules } export enum DefaultChannelTypes { diff --git a/posthog/hogql/database/schema/sessions_v1.py b/posthog/hogql/database/schema/sessions_v1.py index 91b51faf6eb..d2fb8c7d80e 100644 --- a/posthog/hogql/database/schema/sessions_v1.py +++ b/posthog/hogql/database/schema/sessions_v1.py @@ -410,9 +410,7 @@ def get_lazy_session_table_values_v1(key: str, search_term: Optional[str], team: # the sessions table does not have a properties json object like the events and person tables if key == "$channel_type": - return [ - [entry] for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower() - ] + return [[entry] for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.lower()] field_definition = LAZY_SESSIONS_FIELDS.get(key) if not field_definition: diff --git a/posthog/hogql/database/schema/sessions_v2.py b/posthog/hogql/database/schema/sessions_v2.py index 407dd9a7574..08da40eaa68 100644 --- a/posthog/hogql/database/schema/sessions_v2.py +++ b/posthog/hogql/database/schema/sessions_v2.py @@ -503,7 +503,7 @@ def get_lazy_session_table_values_v2(key: str, search_term: Optional[str], team: else: custom_channel_types = [] default_channel_types = [ - entry for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower() + entry for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.lower() ] # merge the list, keep the order, and remove duplicates return [[name] for name in list(dict.fromkeys(custom_channel_types + default_channel_types))] diff --git a/posthog/hogql/database/schema/test/test_channel_type.py b/posthog/hogql/database/schema/test/test_channel_type.py index 2ac8679ca62..c15269536db 100644 --- a/posthog/hogql/database/schema/test/test_channel_type.py +++ b/posthog/hogql/database/schema/test/test_channel_type.py @@ -339,9 +339,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest): }, custom_channel_rules=[ CustomChannelRule( - conditions=[CustomChannelCondition(key="utm_source", op="exact", value="test")], + items=[CustomChannelCondition(key="utm_source", op="exact", value="test", id="1")], channel_type="Test", combiner=FilterLogicalOperator.AND_, + id="a", ) ], ) @@ -355,9 +356,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest): }, custom_channel_rules=[ CustomChannelRule( - conditions=[CustomChannelCondition(key="utm_source", op="exact", value=["test", "test2"])], + items=[CustomChannelCondition(key="utm_source", op="exact", value=["test", "test2"], id="1")], channel_type="Test", combiner=FilterLogicalOperator.AND_, + id="a", ) ], ) @@ -371,9 +373,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest): }, custom_channel_rules=[ CustomChannelRule( - conditions=[CustomChannelCondition(key="utm_source", op="exact", value=["test"])], + items=[CustomChannelCondition(key="utm_source", op="exact", value=["test"], id="1")], channel_type="Test", combiner=FilterLogicalOperator.AND_, + id="a", ) ], ) @@ -388,12 +391,13 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest): }, custom_channel_rules=[ CustomChannelRule( - conditions=[ - CustomChannelCondition(key="utm_source", op="exact", value="s"), - CustomChannelCondition(key="utm_medium", op="exact", value="m"), + items=[ + CustomChannelCondition(key="utm_source", op="exact", value="s", id="1"), + CustomChannelCondition(key="utm_medium", op="exact", value="m", id="2"), ], channel_type="Test", combiner=FilterLogicalOperator.AND_, + id="a", ) ], ) @@ -407,14 +411,16 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest): }, custom_channel_rules=[ CustomChannelRule( - conditions=[CustomChannelCondition(key="utm_source", op="exact", value="1")], + items=[CustomChannelCondition(key="utm_source", op="exact", value="1", id="1")], channel_type="Test1", combiner=FilterLogicalOperator.AND_, + id="a", ), CustomChannelRule( - conditions=[CustomChannelCondition(key="utm_source", op="exact", value="2")], + items=[CustomChannelCondition(key="utm_source", op="exact", value="2", id="2")], channel_type="Test2", combiner=FilterLogicalOperator.AND_, + id="b", ), ], )