mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Improve copying database block https://github.com/siyuan-note/siyuan/issues/11460
断开双向关联 https://github.com/siyuan-note/siyuan/issues/11548
This commit is contained in:
parent
4066348644
commit
421b26b49e
1 changed files with 9 additions and 0 deletions
|
|
@ -68,6 +68,15 @@ func DuplicateDatabaseBlock(avID string) (newAvID, newBlockID string, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
newAv.Name = oldAv.Name + " (Duplicated " + time.Now().Format("2006-01-02 15:04:05") + ")"
|
newAv.Name = oldAv.Name + " (Duplicated " + time.Now().Format("2006-01-02 15:04:05") + ")"
|
||||||
|
|
||||||
|
for _, keyValues := range newAv.KeyValues {
|
||||||
|
if nil != keyValues.Key.Relation && keyValues.Key.Relation.IsTwoWay {
|
||||||
|
// 断开双向关联
|
||||||
|
keyValues.Key.Relation.IsTwoWay = false
|
||||||
|
keyValues.Key.Relation.BackKeyID = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data, err = gulu.JSON.MarshalJSON(newAv)
|
data, err = gulu.JSON.MarshalJSON(newAv)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.LogErrorf("marshal attribute view [%s] failed: %s", newAvID, err)
|
logging.LogErrorf("marshal attribute view [%s] failed: %s", newAvID, err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue