Bläddra i källkod

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

Vanessa 1 år sedan
förälder
incheckning
9ee922794e
2 ändrade filer med 8 tillägg och 8 borttagningar
  1. 6 6
      kernel/model/attribute_view.go
  2. 2 2
      kernel/model/transaction.go

+ 6 - 6
kernel/model/attribute_view.go

@@ -372,13 +372,13 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
 	attrs := parse.IAL2Map(node.KramdownIAL)
 	attrs := parse.IAL2Map(node.KramdownIAL)
 	attrs[NodeAttrNamePrefixAvKey+operation.AvID+"-"+blockValues.Key.ID] = "" // 将列作为属性添加到块中
 	attrs[NodeAttrNamePrefixAvKey+operation.AvID+"-"+blockValues.Key.ID] = "" // 将列作为属性添加到块中
 
 
-	if "" == attrs[NodeAttrNameAVs] {
-		attrs[NodeAttrNameAVs] = operation.AvID
+	if "" == attrs[NodeAttrNameAvs] {
+		attrs[NodeAttrNameAvs] = operation.AvID
 	} else {
 	} else {
-		avIDs := strings.Split(attrs[NodeAttrNameAVs], ",")
+		avIDs := strings.Split(attrs[NodeAttrNameAvs], ",")
 		avIDs = append(avIDs, operation.AvID)
 		avIDs = append(avIDs, operation.AvID)
 		avIDs = gulu.Str.RemoveDuplicatedElem(avIDs)
 		avIDs = gulu.Str.RemoveDuplicatedElem(avIDs)
-		attrs[NodeAttrNameAVs] = strings.Join(avIDs, ",")
+		attrs[NodeAttrNameAvs] = strings.Join(avIDs, ",")
 	}
 	}
 
 
 	if err = setNodeAttrsWithTx(tx, node, tree, attrs); nil != err {
 	if err = setNodeAttrsWithTx(tx, node, tree, attrs); nil != err {
@@ -946,6 +946,6 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) {
 }
 }
 
 
 const (
 const (
-	NodeAttrNameAVs         = "custom-avs"
-	NodeAttrNamePrefixAvKey = "custom-av-key-"
+	NodeAttrNameAvs         = "custom-avs"     // 用于标记块所属的属性视图,逗号分隔 av id
+	NodeAttrNamePrefixAvKey = "custom-av-key-" // 用于标记列
 )
 )

+ 2 - 2
kernel/model/transaction.go

@@ -728,7 +728,7 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
 }
 }
 
 
 func syncDelete2AttributeView(node *ast.Node) {
 func syncDelete2AttributeView(node *ast.Node) {
-	avs := node.IALAttr(NodeAttrNameAVs)
+	avs := node.IALAttr(NodeAttrNameAvs)
 	if "" == avs {
 	if "" == avs {
 		return
 		return
 	}
 	}
@@ -1240,7 +1240,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
 
 
 	// 2. 更新属性视图主键内容
 	// 2. 更新属性视图主键内容
 	for _, updatedDefNode := range updatedDefNodes {
 	for _, updatedDefNode := range updatedDefNodes {
-		avs := updatedDefNode.IALAttr(NodeAttrNameAVs)
+		avs := updatedDefNode.IALAttr(NodeAttrNameAvs)
 		if "" == avs {
 		if "" == avs {
 			continue
 			continue
 		}
 		}