🎨 Improve database field default filling https://github.com/siyuan-note/siyuan/issues/11966

This commit is contained in:
Daniel 2025-08-02 18:17:54 +08:00
parent f1bf15146a
commit 46f81b93ed
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -875,21 +875,21 @@ func (filter *ViewFilter) GetAffectValue(key *Key, defaultVal *Value, addingBloc
case KeyTypeBlock: case KeyTypeBlock:
switch filter.Operator { switch filter.Operator {
case FilterOperatorIsEqual: case FilterOperatorIsEqual:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: filter.Value.Block.Content} ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorIsNotEqual: case FilterOperatorIsNotEqual:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: ""} ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorContains: case FilterOperatorContains:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: filter.Value.Block.Content} ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorDoesNotContain: case FilterOperatorDoesNotContain:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: ""} ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorStartsWith: case FilterOperatorStartsWith:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: filter.Value.Block.Content} ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorEndsWith: case FilterOperatorEndsWith:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: filter.Value.Block.Content} ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorIsEmpty: case FilterOperatorIsEmpty:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: ""} ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
case FilterOperatorIsNotEmpty: case FilterOperatorIsNotEmpty:
ret.Block = &ValueBlock{ID: filter.Value.Block.ID, Content: ""} ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
} }
case KeyTypeText: case KeyTypeText:
switch filter.Operator { switch filter.Operator {