mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Merge branch 'stable'
This commit is contained in:
		
						commit
						c9113ae752
					
				
							
								
								
									
										1
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -3,3 +3,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Datasource local storage ignored files
 | 
					# Datasource local storage ignored files
 | 
				
			||||||
/dataSources.local.xml
 | 
					/dataSources.local.xml
 | 
				
			||||||
 | 
					/dataSources/
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,9 @@ async function getRootCalendarNote() {
 | 
				
			|||||||
            parentNoteId: 'root',
 | 
					            parentNoteId: 'root',
 | 
				
			||||||
            title: 'Calendar',
 | 
					            title: 'Calendar',
 | 
				
			||||||
            target: 'into',
 | 
					            target: 'into',
 | 
				
			||||||
            isProtected: false
 | 
					            isProtected: false,
 | 
				
			||||||
 | 
					            type: 'text',
 | 
				
			||||||
 | 
					            content: ''
 | 
				
			||||||
        })).note;
 | 
					        })).note;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await attributeService.createLabel(rootNote.noteId, CALENDAR_ROOT_LABEL);
 | 
					        await attributeService.createLabel(rootNote.noteId, CALENDAR_ROOT_LABEL);
 | 
				
			||||||
 | 
				
			|||||||
@ -71,22 +71,36 @@ function sendMessageToAllClients(message) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function fillInAdditionalProperties(sync) {
 | 
				
			||||||
 | 
					    // fill in some extra data needed by the frontend
 | 
				
			||||||
 | 
					    if (sync.entityName === 'attributes') {
 | 
				
			||||||
 | 
					        sync.noteId = await sql.getValue(`SELECT noteId
 | 
				
			||||||
 | 
					                                          FROM attributes
 | 
				
			||||||
 | 
					                                          WHERE attributeId = ?`, [sync.entityId]);
 | 
				
			||||||
 | 
					    } else if (sync.entityName === 'note_revisions') {
 | 
				
			||||||
 | 
					        sync.noteId = await sql.getValue(`SELECT noteId
 | 
				
			||||||
 | 
					                                          FROM note_revisions
 | 
				
			||||||
 | 
					                                          WHERE noteRevisionId = ?`, [sync.entityId]);
 | 
				
			||||||
 | 
					    } else if (sync.entityName === 'branches') {
 | 
				
			||||||
 | 
					        const {noteId, parentNoteId} = await sql.getRow(`SELECT noteId, parentNoteId
 | 
				
			||||||
 | 
					                                                         FROM branches
 | 
				
			||||||
 | 
					                                                         WHERE branchId = ?`, [sync.entityId]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        sync.noteId = noteId;
 | 
				
			||||||
 | 
					        sync.parentNoteId = parentNoteId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function sendPing(client) {
 | 
					async function sendPing(client) {
 | 
				
			||||||
    const syncData = require('./sync_table').getEntitySyncsNewerThan(lastAcceptedSyncIds[client.id]);
 | 
					    const syncData = require('./sync_table').getEntitySyncsNewerThan(lastAcceptedSyncIds[client.id]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const sync of syncData) {
 | 
					    for (const sync of syncData) {
 | 
				
			||||||
        // fill in some extra data needed by the frontend
 | 
					        try {
 | 
				
			||||||
        if (sync.entityName === 'attributes') {
 | 
					            await fillInAdditionalProperties(sync);
 | 
				
			||||||
            sync.noteId = await sql.getValue(`SELECT noteId FROM attributes WHERE attributeId = ?`, [sync.entityId]);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if (sync.entityName === 'note_revisions') {
 | 
					        catch (e) {
 | 
				
			||||||
            sync.noteId = await sql.getValue(`SELECT noteId FROM note_revisions WHERE noteRevisionId = ?`, [sync.entityId]);
 | 
					            log.error("Could not fill additional properties for sync " + JSON.stringify(sync)
 | 
				
			||||||
        }
 | 
					                + " because of error: " + e.message + ": " + e.stack);
 | 
				
			||||||
        else if (sync.entityName === 'branches') {
 | 
					 | 
				
			||||||
            const {noteId, parentNoteId} = await sql.getRow(`SELECT noteId, parentNoteId FROM branches WHERE branchId = ?`, [sync.entityId]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            sync.noteId = noteId;
 | 
					 | 
				
			||||||
            sync.parentNoteId = parentNoteId;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user