mirror of
https://github.com/zadam/trilium.git
synced 2025-02-24 23:13:43 +08:00
fix duplicating relations after change, closes #1405
This commit is contained in:
parent
a3a2bc0a74
commit
d5a9abd911
1 changed files with 4 additions and 2 deletions
|
@ -28,8 +28,10 @@ function updateNoteAttribute(req) {
|
||||||
|| body.name !== attribute.name
|
|| body.name !== attribute.name
|
||||||
|| (body.type === 'relation' && body.value !== attribute.value)) {
|
|| (body.type === 'relation' && body.value !== attribute.value)) {
|
||||||
|
|
||||||
|
let newAttribute;
|
||||||
|
|
||||||
if (body.type !== 'relation' || !!body.value.trim()) {
|
if (body.type !== 'relation' || !!body.value.trim()) {
|
||||||
const newAttribute = attribute.createClone(body.type, body.name, body.value);
|
newAttribute = attribute.createClone(body.type, body.name, body.value);
|
||||||
newAttribute.save();
|
newAttribute.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ function updateNoteAttribute(req) {
|
||||||
attribute.save();
|
attribute.save();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
attributeId: attribute.attributeId
|
attributeId: newAttribute ? newAttribute.attributeId : null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue