mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 23:50:13 +01:00
🎨 Support cancel two-way relation when related to the current database https://github.com/siyuan-note/siyuan/issues/11356
This commit is contained in:
parent
47599388e2
commit
933a1936c0
1 changed files with 13 additions and 5 deletions
|
|
@ -2967,7 +2967,13 @@ func RemoveAttributeViewKey(avID, keyID string) (err error) {
|
||||||
if removedKey.Relation.IsTwoWay {
|
if removedKey.Relation.IsTwoWay {
|
||||||
// 删除双向关联的目标列
|
// 删除双向关联的目标列
|
||||||
|
|
||||||
destAv, _ := av.ParseAttributeView(removedKey.Relation.AvID)
|
var destAv *av.AttributeView
|
||||||
|
if avID == removedKey.Relation.AvID {
|
||||||
|
destAv = attrView
|
||||||
|
} else {
|
||||||
|
destAv, _ = av.ParseAttributeView(removedKey.Relation.AvID)
|
||||||
|
}
|
||||||
|
|
||||||
if nil != destAv {
|
if nil != destAv {
|
||||||
destAvRelSrcAv := false
|
destAvRelSrcAv := false
|
||||||
for i, keyValues := range destAv.KeyValues {
|
for i, keyValues := range destAv.KeyValues {
|
||||||
|
|
@ -2993,8 +2999,10 @@ func RemoveAttributeViewKey(avID, keyID string) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if destAv != attrView {
|
||||||
av.SaveAttributeView(destAv)
|
av.SaveAttributeView(destAv)
|
||||||
util.PushReloadAttrView(destAv.ID)
|
util.PushReloadAttrView(destAv.ID)
|
||||||
|
}
|
||||||
|
|
||||||
if !destAvRelSrcAv {
|
if !destAvRelSrcAv {
|
||||||
av.RemoveAvRel(destAv.ID, attrView.ID)
|
av.RemoveAvRel(destAv.ID, attrView.ID)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue