Skip to content

Commit

Permalink
Fix inspection of contact queries using group = "" or group != ""
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 30, 2024
1 parent a005ed7 commit df03be1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contactql/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Inspect(query *ContactQuery) *Inspection {
case PropertyTypeAttribute:
attributes[c.propKey] = true

if c.propKey == AttributeGroup {
if c.propKey == AttributeGroup && c.value != "" {
if query.resolver != nil {
group := query.resolver.ResolveGroup(c.value)
addRef(assets.NewGroupReference(group.UUID(), group.Name()))
Expand Down
11 changes: 11 additions & 0 deletions contactql/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ func TestInspect(t *testing.T) {
AllowAsGroup: false,
},
},
{
query: "group = \"\"", // group presence parsed with resolver
resolver: resolver,
inspection: &contactql.Inspection{
Attributes: []string{"group"},
Schemes: []string{},
Fields: []*assets.FieldReference{},
Groups: []*assets.GroupReference{},
AllowAsGroup: false,
},
},
}

for _, tc := range tests {
Expand Down

0 comments on commit df03be1

Please sign in to comment.