mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	fix overwriting / deleting auto links, closes #1406
This commit is contained in:
		@@ -34,6 +34,10 @@ class Attribute extends Entity {
 | 
			
		||||
        this.isInheritable = !!this.isInheritable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    isAutoLink() {
 | 
			
		||||
        return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @returns {Note|null}
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -147,9 +147,11 @@ function updateNoteAttributes(req) {
 | 
			
		||||
 | 
			
		||||
    // all the remaining existing attributes are not defined anymore and should be deleted
 | 
			
		||||
    for (const toDeleteAttr of existingAttrs) {
 | 
			
		||||
        if (!toDeleteAttr.isAutoLink()) {
 | 
			
		||||
            toDeleteAttr.isDeleted = true;
 | 
			
		||||
            toDeleteAttr.save();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getAttributeNames(req) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user