Parcourir la source

Merge remote-tracking branch 'origin/dev' into dev

Vanessa il y a 1 an
Parent
commit
1fc169548d

+ 2 - 1
app/appearance/langs/en_US.json

@@ -1471,6 +1471,7 @@
     "238": "Marketplace package [%s] update failed, please try again later",
     "239": "Related operations are being processed, please try again later",
     "240": "Drag heading under container blocks in the doc is not supported",
-    "241": "Drag to its subheading is not supported"
+    "241": "Drag to its subheading is not supported",
+    "242": "The binding block already exists in the current database"
   }
 }

+ 2 - 1
app/appearance/langs/es_ES.json

@@ -1471,6 +1471,7 @@
     "238": "Error en la actualización del paquete Marketplace [%s], inténtalo de nuevo más tarde",
     "239": "Las operaciones relacionadas se están procesando, inténtalo de nuevo más tarde",
     "240": "No se admite arrastrar encabezado debajo de los bloques contenedores en el documento",
-    "241": "No se admite arrastrar a su subtítulo"
+    "241": "No se admite arrastrar a su subtítulo",
+    "242": "El bloque de enlace ya existe en la base de datos actual"
   }
 }

+ 2 - 1
app/appearance/langs/fr_FR.json

@@ -1471,6 +1471,7 @@
     "238": "La mise à jour du package Marketplace [%s] a échoué, veuillez réessayer plus tard",
     "239": "Les opérations associées sont en cours de traitement, veuillez réessayer plus tard",
     "240": "Le déplacement du titre sous les blocs conteneurs dans la doc n'est pas pris en charge",
-    "241": "Le glisser vers son sous-titre n'est pas pris en charge"
+    "241": "Le glisser vers son sous-titre n'est pas pris en charge",
+    "242": "Le bloc de liaison existe déjà dans la base de données actuelle"
   }
 }

+ 2 - 1
app/appearance/langs/zh_CHT.json

@@ -1471,6 +1471,7 @@
     "238": "市集包 [%s] 更新失敗,請稍後再試",
     "239": "相關操作正在處理中,請稍後再試",
     "240": "不支援拖曳文件中容器區塊下的標題",
-    "241": "不支持拖曳為自己的子標題"
+    "241": "不支持拖曳為自己的子標題",
+    "242": "目前資料庫中已經存在該綁定區塊"
   }
 }

+ 2 - 1
app/appearance/langs/zh_CN.json

@@ -1471,6 +1471,7 @@
     "238": "集市包 [%s] 更新失败,请稍后再试",
     "239": "相关操作正在处理中,请稍后再试",
     "240": "不支持拖拽文档中容器块下的标题",
-    "241": "不支持拖拽为自己的子标题"
+    "241": "不支持拖拽为自己的子标题",
+    "242": "当前数据库中已经存在该绑定块"
   }
 }

+ 12 - 0
kernel/model/attribute_view.go

@@ -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 {