mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	#run should respect inheritance, fixes #3669
This commit is contained in:
		
							parent
							
								
									540d19c67c
								
							
						
					
					
						commit
						62c2547557
					
				@ -38,7 +38,7 @@ function run(req) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getBundlesWithLabel(label, value) {
 | 
					function getBundlesWithLabel(label, value) {
 | 
				
			||||||
    const notes = attributeService.getNotesWithLabelFast(label, value);
 | 
					    const notes = attributeService.getNotesWithLabel(label, value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const bundles = [];
 | 
					    const bundles = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,8 +3,7 @@ const cls = require('./cls');
 | 
				
			|||||||
const sqlInit = require('./sql_init');
 | 
					const sqlInit = require('./sql_init');
 | 
				
			||||||
const config = require('./config');
 | 
					const config = require('./config');
 | 
				
			||||||
const log = require('./log');
 | 
					const log = require('./log');
 | 
				
			||||||
const sql = require("./sql");
 | 
					const attributeService = require("../services/attributes");
 | 
				
			||||||
const becca = require("../becca/becca");
 | 
					 | 
				
			||||||
const protectedSessionService = require("../services/protected_session");
 | 
					const protectedSessionService = require("../services/protected_session");
 | 
				
			||||||
const hiddenSubtreeService = require("./hidden_subtree");
 | 
					const hiddenSubtreeService = require("./hidden_subtree");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20,23 +19,9 @@ function getRunAtHours(note) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function runNotesWithLabel(runAttrValue) {
 | 
					function runNotesWithLabel(runAttrValue) {
 | 
				
			||||||
    // TODO: should be refactored into becca search
 | 
					 | 
				
			||||||
    const noteIds = sql.getColumn(`
 | 
					 | 
				
			||||||
        SELECT notes.noteId 
 | 
					 | 
				
			||||||
        FROM notes 
 | 
					 | 
				
			||||||
        JOIN attributes ON attributes.noteId = notes.noteId
 | 
					 | 
				
			||||||
                       AND attributes.isDeleted = 0
 | 
					 | 
				
			||||||
                       AND attributes.type = 'label'
 | 
					 | 
				
			||||||
                       AND attributes.name = 'run' 
 | 
					 | 
				
			||||||
                       AND attributes.value = ? 
 | 
					 | 
				
			||||||
        WHERE
 | 
					 | 
				
			||||||
          notes.type = 'code'
 | 
					 | 
				
			||||||
          AND notes.isDeleted = 0`, [runAttrValue]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const notes = becca.getNotes(noteIds);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const instanceName = config.General ? config.General.instanceName : null;
 | 
					    const instanceName = config.General ? config.General.instanceName : null;
 | 
				
			||||||
    const currentHours = new Date().getHours();
 | 
					    const currentHours = new Date().getHours();
 | 
				
			||||||
 | 
					    const notes = attributeService.getNotesWithLabel('run', runAttrValue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const note of notes) {
 | 
					    for (const note of notes) {
 | 
				
			||||||
        const runOnInstances = note.getLabelValues('runOnInstance');
 | 
					        const runOnInstances = note.getLabelValues('runOnInstance');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user