🎨 Improve database primary key binding block https://github.com/siyuan-note/siyuan/issues/10945

This commit is contained in:
Daniel 2024-04-10 22:58:59 +08:00
parent 12ee5d5c4d
commit fc3263985b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 22 additions and 5 deletions

View file

@ -2129,6 +2129,7 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
blockValue.IsDetached = isDetached
blockValue.Block.Content = content
blockValue.UpdatedAt = now
util.PushMsg(Conf.language(242), 3000)
err = av.SaveAttributeView(attrView)
}
return
@ -2869,6 +2870,17 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
node, _, _ = getNodeByBlockID(tx, operation.NextID)
}
// 检查是否已经存在绑定块
// Improve database primary key binding block https://github.com/siyuan-note/siyuan/issues/10945
for _, keyValues := range attrView.KeyValues {
for _, value := range keyValues.Values {
if value.BlockID == operation.NextID {
util.PushMsg(Conf.language(242), 3000)
return
}
}
}
for _, keyValues := range attrView.KeyValues {
for _, value := range keyValues.Values {
if value.BlockID == operation.PreviousID {