diff --git a/forms/collection_upsert.go b/forms/collection_upsert.go index 7ab76d15..576db38a 100644 --- a/forms/collection_upsert.go +++ b/forms/collection_upsert.go @@ -279,8 +279,12 @@ func (form *CollectionUpsert) checkRule(value any) error { return nil // nothing to check } - dummy := &models.Collection{Schema: form.Schema} - r := resolvers.NewRecordFieldResolver(form.dao, dummy, nil, true) + dummy := *form.collection + dummy.Schema = form.Schema + dummy.System = form.System + dummy.Options = form.Options + + r := resolvers.NewRecordFieldResolver(form.dao, &dummy, nil, true) _, err := search.FilterData(*v).BuildExpr(r) if err != nil { diff --git a/forms/collection_upsert_test.go b/forms/collection_upsert_test.go index 9a487ace..1f510a8f 100644 --- a/forms/collection_upsert_test.go +++ b/forms/collection_upsert_test.go @@ -279,11 +279,11 @@ func TestCollectionUpsertValidateAndSubmit(t *testing.T) { "schema": [ {"id":"_2hlxbmp","name":"test","type":"text"} ], - "listRule": "test='123'", - "viewRule": "test='123'", - "createRule": "test='123'", - "updateRule": "test='123'", - "deleteRule": "test='123'", + "listRule": "test='123' && verified = true", + "viewRule": "test='123' && emailVisibility = true", + "createRule": "test='123' && email != ''", + "updateRule": "test='123' && username != ''", + "deleteRule": "test='123' && id != ''", "options": {"minPasswordLength": 10} }`, []string{},